2025-03-28 10:40:09 -04:00
|
|
|
import { SharedLinkType } from 'src/enum';
|
2025-03-29 09:26:24 -04:00
|
|
|
import { AlbumTable } from 'src/schema/tables/album.table';
|
|
|
|
|
import { UserTable } from 'src/schema/tables/user.table';
|
2025-06-30 13:19:16 -04:00
|
|
|
import {
|
|
|
|
|
Column,
|
|
|
|
|
CreateDateColumn,
|
|
|
|
|
ForeignKeyColumn,
|
|
|
|
|
Generated,
|
|
|
|
|
PrimaryGeneratedColumn,
|
|
|
|
|
Table,
|
|
|
|
|
Timestamp,
|
|
|
|
|
Unique,
|
|
|
|
|
} from 'src/sql-tools';
|
2025-03-28 10:40:09 -04:00
|
|
|
|
|
|
|
|
@Table('shared_links')
|
|
|
|
|
@Unique({ name: 'UQ_sharedlink_key', columns: ['key'] })
|
|
|
|
|
export class SharedLinkTable {
|
|
|
|
|
@PrimaryGeneratedColumn()
|
2025-06-30 13:19:16 -04:00
|
|
|
id!: Generated<string>;
|
2025-03-28 10:40:09 -04:00
|
|
|
|
|
|
|
|
@Column({ type: 'character varying', nullable: true })
|
|
|
|
|
description!: string | null;
|
|
|
|
|
|
|
|
|
|
@ForeignKeyColumn(() => UserTable, { onDelete: 'CASCADE', onUpdate: 'CASCADE' })
|
|
|
|
|
userId!: string;
|
|
|
|
|
|
2025-04-17 14:41:06 -04:00
|
|
|
@Column({ type: 'bytea', indexName: 'IDX_sharedlink_key' })
|
2025-05-09 09:10:34 -04:00
|
|
|
key!: Buffer; // use to access the individual asset
|
2025-03-28 10:40:09 -04:00
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
|
type!: SharedLinkType;
|
|
|
|
|
|
|
|
|
|
@CreateDateColumn()
|
2025-06-30 13:19:16 -04:00
|
|
|
createdAt!: Generated<Timestamp>;
|
2025-03-28 10:40:09 -04:00
|
|
|
|
|
|
|
|
@Column({ type: 'timestamp with time zone', nullable: true })
|
2025-06-30 13:19:16 -04:00
|
|
|
expiresAt!: Timestamp | null;
|
2025-03-28 10:40:09 -04:00
|
|
|
|
|
|
|
|
@Column({ type: 'boolean', default: false })
|
|
|
|
|
allowUpload!: boolean;
|
|
|
|
|
|
2025-04-17 14:41:06 -04:00
|
|
|
@ForeignKeyColumn(() => AlbumTable, {
|
|
|
|
|
nullable: true,
|
|
|
|
|
onDelete: 'CASCADE',
|
|
|
|
|
onUpdate: 'CASCADE',
|
|
|
|
|
indexName: 'IDX_sharedlink_albumId',
|
|
|
|
|
})
|
2025-06-30 13:19:16 -04:00
|
|
|
albumId!: string | null;
|
2025-04-07 15:12:12 -04:00
|
|
|
|
2025-03-28 10:40:09 -04:00
|
|
|
@Column({ type: 'boolean', default: true })
|
2025-06-30 13:19:16 -04:00
|
|
|
allowDownload!: Generated<boolean>;
|
2025-03-28 10:40:09 -04:00
|
|
|
|
|
|
|
|
@Column({ type: 'boolean', default: true })
|
2025-06-30 13:19:16 -04:00
|
|
|
showExif!: Generated<boolean>;
|
2025-04-07 15:12:12 -04:00
|
|
|
|
|
|
|
|
@Column({ type: 'character varying', nullable: true })
|
|
|
|
|
password!: string | null;
|
2025-03-28 10:40:09 -04:00
|
|
|
}
|