mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
infra(server): fix Album TypeORM relations and change ids to uuids (#1582)
* infra: make api-key primary key column a UUID * infra: move ManyToMany relations in album entity, make ownerId ManyToOne --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
@@ -12,12 +12,12 @@ export class APIKeyRepository implements IKeyRepository {
|
||||
return this.repository.save(dto);
|
||||
}
|
||||
|
||||
async update(userId: string, id: number, dto: Partial<APIKeyEntity>): Promise<APIKeyEntity> {
|
||||
async update(userId: string, id: string, dto: Partial<APIKeyEntity>): Promise<APIKeyEntity> {
|
||||
await this.repository.update({ userId, id }, dto);
|
||||
return this.repository.findOneOrFail({ where: { id: dto.id } });
|
||||
}
|
||||
|
||||
async delete(userId: string, id: number): Promise<void> {
|
||||
async delete(userId: string, id: string): Promise<void> {
|
||||
await this.repository.delete({ userId, id });
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export class APIKeyRepository implements IKeyRepository {
|
||||
});
|
||||
}
|
||||
|
||||
getById(userId: string, id: number): Promise<APIKeyEntity | null> {
|
||||
getById(userId: string, id: string): Promise<APIKeyEntity | null> {
|
||||
return this.repository.findOne({ where: { userId, id } });
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,7 @@ export class SharedLinkRepository implements ISharedLinkRepository {
|
||||
},
|
||||
album: {
|
||||
assets: {
|
||||
assetInfo: {
|
||||
exifInfo: true,
|
||||
},
|
||||
exifInfo: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -37,9 +35,7 @@ export class SharedLinkRepository implements ISharedLinkRepository {
|
||||
},
|
||||
album: {
|
||||
assets: {
|
||||
assetInfo: {
|
||||
createdAt: 'ASC',
|
||||
},
|
||||
createdAt: 'ASC',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -69,9 +65,7 @@ export class SharedLinkRepository implements ISharedLinkRepository {
|
||||
relations: {
|
||||
assets: true,
|
||||
album: {
|
||||
assets: {
|
||||
assetInfo: true,
|
||||
},
|
||||
assets: true,
|
||||
},
|
||||
user: true,
|
||||
},
|
||||
@@ -109,7 +103,7 @@ export class SharedLinkRepository implements ISharedLinkRepository {
|
||||
id,
|
||||
album: {
|
||||
assets: {
|
||||
assetId,
|
||||
id: assetId,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user