mirror of
https://github.com/immich-app/immich.git
synced 2026-03-01 18:19:10 +03:00
refactor: database column names (#23356)
This commit is contained in:
@@ -18,7 +18,7 @@ export class MemoryRepository implements IBulkAsset {
|
||||
await this.db
|
||||
.deleteFrom('memory_asset')
|
||||
.using('asset')
|
||||
.whereRef('memory_asset.assetsId', '=', 'asset.id')
|
||||
.whereRef('memory_asset.assetId', '=', 'asset.id')
|
||||
.where('asset.visibility', '!=', AssetVisibility.Timeline)
|
||||
.execute();
|
||||
|
||||
@@ -64,7 +64,7 @@ export class MemoryRepository implements IBulkAsset {
|
||||
eb
|
||||
.selectFrom('asset')
|
||||
.selectAll('asset')
|
||||
.innerJoin('memory_asset', 'asset.id', 'memory_asset.assetsId')
|
||||
.innerJoin('memory_asset', 'asset.id', 'memory_asset.assetId')
|
||||
.whereRef('memory_asset.memoriesId', '=', 'memory.id')
|
||||
.orderBy('asset.fileCreatedAt', 'asc')
|
||||
.where('asset.visibility', '=', sql.lit(AssetVisibility.Timeline))
|
||||
@@ -86,7 +86,7 @@ export class MemoryRepository implements IBulkAsset {
|
||||
const { id } = await tx.insertInto('memory').values(memory).returning('id').executeTakeFirstOrThrow();
|
||||
|
||||
if (assetIds.size > 0) {
|
||||
const values = [...assetIds].map((assetId) => ({ memoriesId: id, assetsId: assetId }));
|
||||
const values = [...assetIds].map((assetId) => ({ memoriesId: id, assetId }));
|
||||
await tx.insertInto('memory_asset').values(values).execute();
|
||||
}
|
||||
|
||||
@@ -116,12 +116,12 @@ export class MemoryRepository implements IBulkAsset {
|
||||
|
||||
const results = await this.db
|
||||
.selectFrom('memory_asset')
|
||||
.select(['assetsId'])
|
||||
.select(['assetId'])
|
||||
.where('memoriesId', '=', id)
|
||||
.where('assetsId', 'in', assetIds)
|
||||
.where('assetId', 'in', assetIds)
|
||||
.execute();
|
||||
|
||||
return new Set(results.map(({ assetsId }) => assetsId));
|
||||
return new Set(results.map(({ assetId }) => assetId));
|
||||
}
|
||||
|
||||
@GenerateSql({ params: [DummyValue.UUID, [DummyValue.UUID]] })
|
||||
@@ -132,7 +132,7 @@ export class MemoryRepository implements IBulkAsset {
|
||||
|
||||
await this.db
|
||||
.insertInto('memory_asset')
|
||||
.values(assetIds.map((assetId) => ({ memoriesId: id, assetsId: assetId })))
|
||||
.values(assetIds.map((assetId) => ({ memoriesId: id, assetId })))
|
||||
.execute();
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ export class MemoryRepository implements IBulkAsset {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.db.deleteFrom('memory_asset').where('memoriesId', '=', id).where('assetsId', 'in', assetIds).execute();
|
||||
await this.db.deleteFrom('memory_asset').where('memoriesId', '=', id).where('assetId', 'in', assetIds).execute();
|
||||
}
|
||||
|
||||
private getByIdBuilder(id: string) {
|
||||
@@ -155,7 +155,7 @@ export class MemoryRepository implements IBulkAsset {
|
||||
eb
|
||||
.selectFrom('asset')
|
||||
.selectAll('asset')
|
||||
.innerJoin('memory_asset', 'asset.id', 'memory_asset.assetsId')
|
||||
.innerJoin('memory_asset', 'asset.id', 'memory_asset.assetId')
|
||||
.whereRef('memory_asset.memoriesId', '=', 'memory.id')
|
||||
.orderBy('asset.fileCreatedAt', 'asc')
|
||||
.where('asset.visibility', '=', sql.lit(AssetVisibility.Timeline))
|
||||
|
||||
Reference in New Issue
Block a user