mirror of
https://github.com/immich-app/immich.git
synced 2026-02-12 20:08:25 +03:00
rename albums_shared_users_users to album_permissions and add readonly column
This commit is contained in:
17
server/src/entities/album-permission.entity.ts
Normal file
17
server/src/entities/album-permission.entity.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { AlbumEntity } from 'src/entities/album.entity';
|
||||
import { UserEntity } from 'src/entities/user.entity';
|
||||
import { Column, Entity, ManyToOne, PrimaryColumn } from 'typeorm';
|
||||
|
||||
@Entity('albums_shared_users_users')
|
||||
export class AlbumPermissionsEntity {
|
||||
@PrimaryColumn({ type: 'uuid', name: 'albumsId', foreignKeyConstraintName: 'FK_f48513bf9bccefd6ff3ad30bd06' })
|
||||
@ManyToOne(() => AlbumEntity, { onDelete: 'CASCADE', onUpdate: 'CASCADE', nullable: false })
|
||||
albums!: AlbumEntity;
|
||||
|
||||
@PrimaryColumn({ type: 'uuid', name: 'usersId', foreignKeyConstraintName: 'FK_427c350ad49bd3935a50baab737' })
|
||||
@ManyToOne(() => UserEntity, { onDelete: 'CASCADE', onUpdate: 'CASCADE', nullable: false })
|
||||
users!: UserEntity;
|
||||
|
||||
@Column({ default: true })
|
||||
readonly!: boolean;
|
||||
}
|
||||
@@ -53,7 +53,19 @@ export class AlbumEntity {
|
||||
albumThumbnailAssetId!: string | null;
|
||||
|
||||
@ManyToMany(() => UserEntity)
|
||||
@JoinTable()
|
||||
@JoinTable({
|
||||
name: 'albums_shared_users_users',
|
||||
inverseJoinColumn: {
|
||||
name: 'usersId',
|
||||
referencedColumnName: 'id',
|
||||
foreignKeyConstraintName: 'FK_f48513bf9bccefd6ff3ad30bd06',
|
||||
},
|
||||
joinColumn: {
|
||||
name: 'albumsId',
|
||||
referencedColumnName: 'id',
|
||||
foreignKeyConstraintName: 'FK_427c350ad49bd3935a50baab737',
|
||||
},
|
||||
})
|
||||
sharedUsers!: UserEntity[];
|
||||
|
||||
@ManyToMany(() => AssetEntity, (asset) => asset.albums)
|
||||
|
||||
Reference in New Issue
Block a user