chore(server): sql versioning (#5346)

* chore(server): sql versioning

* chore: always add newline to end of file

* refactor: generator

* chore: pr feedback

* chore: pr feedback
This commit is contained in:
Jason Rasmussen
2023-11-30 10:10:30 -05:00
committed by GitHub
parent ffecfbe075
commit 5e55a17b2a
34 changed files with 3012 additions and 9 deletions

View File

@@ -3,11 +3,13 @@ import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { SharedLinkEntity } from '../entities';
import { DummyValue, GenerateSql } from '../infra.util';
@Injectable()
export class SharedLinkRepository implements ISharedLinkRepository {
constructor(@InjectRepository(SharedLinkEntity) private repository: Repository<SharedLinkEntity>) {}
@GenerateSql({ params: [DummyValue.UUID, DummyValue.UUID] })
get(userId: string, id: string): Promise<SharedLinkEntity | null> {
return this.repository.findOne({
where: {
@@ -39,6 +41,7 @@ export class SharedLinkRepository implements ISharedLinkRepository {
});
}
@GenerateSql({ params: [DummyValue.UUID] })
getAll(userId: string): Promise<SharedLinkEntity[]> {
return this.repository.find({
where: {
@@ -56,6 +59,7 @@ export class SharedLinkRepository implements ISharedLinkRepository {
});
}
@GenerateSql({ params: [DummyValue.BUFFER] })
async getByKey(key: Buffer): Promise<SharedLinkEntity | null> {
return await this.repository.findOne({
where: {