mirror of
https://github.com/immich-app/immich.git
synced 2025-12-18 09:13:15 +03:00
feat(server) Tagging system (#1046)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Column, Entity, Index, OneToOne, PrimaryGeneratedColumn, Unique } from 'typeorm';
|
||||
import { Column, Entity, Index, JoinTable, ManyToMany, OneToOne, PrimaryGeneratedColumn, Unique } from 'typeorm';
|
||||
import { ExifEntity } from './exif.entity';
|
||||
import { SmartInfoEntity } from './smart-info.entity';
|
||||
import { TagEntity } from './tag.entity';
|
||||
|
||||
@Entity('assets')
|
||||
@Unique('UQ_userid_checksum', ['userId', 'checksum'])
|
||||
@@ -62,6 +63,11 @@ export class AssetEntity {
|
||||
|
||||
@OneToOne(() => SmartInfoEntity, (smartInfoEntity) => smartInfoEntity.asset)
|
||||
smartInfo?: SmartInfoEntity;
|
||||
|
||||
// https://github.com/typeorm/typeorm/blob/master/docs/many-to-many-relations.md
|
||||
@ManyToMany(() => TagEntity, (tag) => tag.assets, { cascade: true })
|
||||
@JoinTable({ name: 'tag_asset' })
|
||||
tags!: TagEntity[];
|
||||
}
|
||||
|
||||
export enum AssetType {
|
||||
|
||||
Reference in New Issue
Block a user