mirror of
https://github.com/immich-app/immich.git
synced 2026-03-08 02:57:48 +03:00
feat: asset metadata (#20446)
This commit is contained in:
@@ -7,13 +7,10 @@ import { columns } from 'src/database';
|
||||
import { DummyValue, GenerateSql } from 'src/decorators';
|
||||
import { AssetType, AssetVisibility, UserStatus } from 'src/enum';
|
||||
import { DB } from 'src/schema';
|
||||
import { UserMetadataTable } from 'src/schema/tables/user-metadata.table';
|
||||
import { UserTable } from 'src/schema/tables/user.table';
|
||||
import { UserMetadata, UserMetadataItem } from 'src/types';
|
||||
import { asUuid } from 'src/utils/database';
|
||||
|
||||
type Upsert = Insertable<UserMetadataTable>;
|
||||
|
||||
export interface UserListFilter {
|
||||
id?: string;
|
||||
withDeleted?: boolean;
|
||||
@@ -211,12 +208,12 @@ export class UserRepository {
|
||||
async upsertMetadata<T extends keyof UserMetadata>(id: string, { key, value }: { key: T; value: UserMetadata[T] }) {
|
||||
await this.db
|
||||
.insertInto('user_metadata')
|
||||
.values({ userId: id, key, value } as Upsert)
|
||||
.values({ userId: id, key, value })
|
||||
.onConflict((oc) =>
|
||||
oc.columns(['userId', 'key']).doUpdateSet({
|
||||
key,
|
||||
value,
|
||||
} as Upsert),
|
||||
}),
|
||||
)
|
||||
.execute();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user