refactor: database types (#19624)
This commit is contained in:
@@ -1,13 +1,22 @@
|
||||
import { SharedLinkType } from 'src/enum';
|
||||
import { AlbumTable } from 'src/schema/tables/album.table';
|
||||
import { UserTable } from 'src/schema/tables/user.table';
|
||||
import { Column, CreateDateColumn, ForeignKeyColumn, PrimaryGeneratedColumn, Table, Unique } from 'src/sql-tools';
|
||||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
ForeignKeyColumn,
|
||||
Generated,
|
||||
PrimaryGeneratedColumn,
|
||||
Table,
|
||||
Timestamp,
|
||||
Unique,
|
||||
} from 'src/sql-tools';
|
||||
|
||||
@Table('shared_links')
|
||||
@Unique({ name: 'UQ_sharedlink_key', columns: ['key'] })
|
||||
export class SharedLinkTable {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: string;
|
||||
id!: Generated<string>;
|
||||
|
||||
@Column({ type: 'character varying', nullable: true })
|
||||
description!: string | null;
|
||||
@@ -22,10 +31,10 @@ export class SharedLinkTable {
|
||||
type!: SharedLinkType;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt!: Date;
|
||||
createdAt!: Generated<Timestamp>;
|
||||
|
||||
@Column({ type: 'timestamp with time zone', nullable: true })
|
||||
expiresAt!: Date | null;
|
||||
expiresAt!: Timestamp | null;
|
||||
|
||||
@Column({ type: 'boolean', default: false })
|
||||
allowUpload!: boolean;
|
||||
@@ -36,13 +45,13 @@ export class SharedLinkTable {
|
||||
onUpdate: 'CASCADE',
|
||||
indexName: 'IDX_sharedlink_albumId',
|
||||
})
|
||||
albumId!: string;
|
||||
albumId!: string | null;
|
||||
|
||||
@Column({ type: 'boolean', default: true })
|
||||
allowDownload!: boolean;
|
||||
allowDownload!: Generated<boolean>;
|
||||
|
||||
@Column({ type: 'boolean', default: true })
|
||||
showExif!: boolean;
|
||||
showExif!: Generated<boolean>;
|
||||
|
||||
@Column({ type: 'character varying', nullable: true })
|
||||
password!: string | null;
|
||||
|
||||
Reference in New Issue
Block a user