dev: naming
This commit is contained in:
parent
717dfe51e7
commit
a85780c930
4 changed files with 23 additions and 23 deletions
|
@ -10,8 +10,8 @@ import {
|
|||
UpdateDateColumn,
|
||||
} from 'typeorm';
|
||||
import { AssetEntity } from './asset.entity';
|
||||
import { RuleEntity } from './rule.entity';
|
||||
import { SharedLinkEntity } from './shared-link.entity';
|
||||
import { SmartAlbumPolicyEntity } from './smart-album-policy.entity';
|
||||
import { UserEntity } from './user.entity';
|
||||
|
||||
@Entity('albums')
|
||||
|
@ -54,6 +54,6 @@ export class AlbumEntity {
|
|||
@OneToMany(() => SharedLinkEntity, (link) => link.album)
|
||||
sharedLinks!: SharedLinkEntity[];
|
||||
|
||||
@OneToMany(() => SmartAlbumPolicyEntity, (policy) => policy.album)
|
||||
policies!: SmartAlbumPolicyEntity[];
|
||||
@OneToMany(() => RuleEntity, (rule) => rule.album)
|
||||
rules!: RuleEntity[];
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ import { AssetFaceEntity } from './asset-face.entity';
|
|||
import { AssetEntity } from './asset.entity';
|
||||
import { PartnerEntity } from './partner.entity';
|
||||
import { PersonEntity } from './person.entity';
|
||||
import { RuleEntity } from './rule.entity';
|
||||
import { SharedLinkEntity } from './shared-link.entity';
|
||||
import { SmartAlbumPolicyEntity } from './smart-album-policy.entity';
|
||||
import { SmartInfoEntity } from './smart-info.entity';
|
||||
import { SystemConfigEntity } from './system-config.entity';
|
||||
import { TagEntity } from './tag.entity';
|
||||
|
@ -19,8 +19,8 @@ export * from './asset.entity';
|
|||
export * from './exif.entity';
|
||||
export * from './partner.entity';
|
||||
export * from './person.entity';
|
||||
export * from './rule.entity';
|
||||
export * from './shared-link.entity';
|
||||
export * from './smart-album-policy.entity';
|
||||
export * from './smart-info.entity';
|
||||
export * from './system-config.entity';
|
||||
export * from './tag.entity';
|
||||
|
@ -35,7 +35,7 @@ export const databaseEntities = [
|
|||
PartnerEntity,
|
||||
PersonEntity,
|
||||
SharedLinkEntity,
|
||||
SmartAlbumPolicyEntity,
|
||||
RuleEntity,
|
||||
SmartInfoEntity,
|
||||
SystemConfigEntity,
|
||||
TagEntity,
|
||||
|
|
|
@ -2,13 +2,13 @@ import { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn } from 'typeor
|
|||
import { AlbumEntity } from './album.entity';
|
||||
import { UserEntity } from './user.entity';
|
||||
|
||||
@Entity('smart-album-policies')
|
||||
export class SmartAlbumPolicyEntity {
|
||||
@Entity('rules')
|
||||
export class RuleEntity {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id!: string;
|
||||
|
||||
@Column()
|
||||
type!: PolicyType;
|
||||
key!: RuleKey;
|
||||
|
||||
@Column()
|
||||
value!: string;
|
||||
|
@ -23,11 +23,11 @@ export class SmartAlbumPolicyEntity {
|
|||
albumId!: string;
|
||||
|
||||
@Index('IDX_smartAlbumPolicy_albumId')
|
||||
@ManyToOne(() => AlbumEntity, (album) => album.policies, { onDelete: 'CASCADE', onUpdate: 'CASCADE' })
|
||||
@ManyToOne(() => AlbumEntity, (album) => album.rules, { onDelete: 'CASCADE', onUpdate: 'CASCADE' })
|
||||
album!: AlbumEntity;
|
||||
}
|
||||
|
||||
export enum PolicyType {
|
||||
PERSON = 'PERSON', // Value is a personId
|
||||
LOCATION = 'LOCATION', // Value is the location in text
|
||||
export enum RuleKey {
|
||||
PERSON = 'personId',
|
||||
EXIF_CITY = 'exifInfo.city',
|
||||
}
|
20
server/test/fixtures/album.stub.ts
vendored
20
server/test/fixtures/album.stub.ts
vendored
|
@ -17,7 +17,7 @@ export const albumStub = {
|
|||
updatedAt: new Date(),
|
||||
sharedLinks: [],
|
||||
sharedUsers: [],
|
||||
policies: [],
|
||||
rules: [],
|
||||
}),
|
||||
sharedWithUser: Object.freeze<AlbumEntity>({
|
||||
id: 'album-2',
|
||||
|
@ -32,7 +32,7 @@ export const albumStub = {
|
|||
updatedAt: new Date(),
|
||||
sharedLinks: [],
|
||||
sharedUsers: [userStub.user1],
|
||||
policies: [],
|
||||
rules: [],
|
||||
}),
|
||||
sharedWithMultiple: Object.freeze<AlbumEntity>({
|
||||
id: 'album-3',
|
||||
|
@ -47,7 +47,7 @@ export const albumStub = {
|
|||
updatedAt: new Date(),
|
||||
sharedLinks: [],
|
||||
sharedUsers: [userStub.user1, userStub.user2],
|
||||
policies: [],
|
||||
rules: [],
|
||||
}),
|
||||
sharedWithAdmin: Object.freeze<AlbumEntity>({
|
||||
id: 'album-3',
|
||||
|
@ -62,7 +62,7 @@ export const albumStub = {
|
|||
updatedAt: new Date(),
|
||||
sharedLinks: [],
|
||||
sharedUsers: [userStub.admin],
|
||||
policies: [],
|
||||
rules: [],
|
||||
}),
|
||||
oneAsset: Object.freeze<AlbumEntity>({
|
||||
id: 'album-4',
|
||||
|
@ -77,7 +77,7 @@ export const albumStub = {
|
|||
updatedAt: new Date(),
|
||||
sharedLinks: [],
|
||||
sharedUsers: [],
|
||||
policies: [],
|
||||
rules: [],
|
||||
}),
|
||||
twoAssets: Object.freeze<AlbumEntity>({
|
||||
id: 'album-4a',
|
||||
|
@ -92,7 +92,7 @@ export const albumStub = {
|
|||
updatedAt: new Date(),
|
||||
sharedLinks: [],
|
||||
sharedUsers: [],
|
||||
policies: [],
|
||||
rules: [],
|
||||
}),
|
||||
emptyWithInvalidThumbnail: Object.freeze<AlbumEntity>({
|
||||
id: 'album-5',
|
||||
|
@ -107,7 +107,7 @@ export const albumStub = {
|
|||
updatedAt: new Date(),
|
||||
sharedLinks: [],
|
||||
sharedUsers: [],
|
||||
policies: [],
|
||||
rules: [],
|
||||
}),
|
||||
emptyWithValidThumbnail: Object.freeze<AlbumEntity>({
|
||||
id: 'album-5',
|
||||
|
@ -122,7 +122,7 @@ export const albumStub = {
|
|||
updatedAt: new Date(),
|
||||
sharedLinks: [],
|
||||
sharedUsers: [],
|
||||
policies: [],
|
||||
rules: [],
|
||||
}),
|
||||
oneAssetInvalidThumbnail: Object.freeze<AlbumEntity>({
|
||||
id: 'album-6',
|
||||
|
@ -137,7 +137,7 @@ export const albumStub = {
|
|||
updatedAt: new Date(),
|
||||
sharedLinks: [],
|
||||
sharedUsers: [],
|
||||
policies: [],
|
||||
rules: [],
|
||||
}),
|
||||
oneAssetValidThumbnail: Object.freeze<AlbumEntity>({
|
||||
id: 'album-6',
|
||||
|
@ -152,6 +152,6 @@ export const albumStub = {
|
|||
updatedAt: new Date(),
|
||||
sharedLinks: [],
|
||||
sharedUsers: [],
|
||||
policies: [],
|
||||
rules: [],
|
||||
}),
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue