mirror of
https://github.com/immich-app/immich
synced 2026-08-22 13:13:05 +00:00
Merge 71a9070f4a into af33a78d18
This commit is contained in:
commit
c22c5e67c6
7 changed files with 46 additions and 14 deletions
|
|
@ -230,8 +230,8 @@ export type Session = {
|
|||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
expiresAt: Date | null;
|
||||
deviceOS: string;
|
||||
deviceType: string;
|
||||
deviceOS: string | null;
|
||||
deviceType: string | null;
|
||||
appVersion: string | null;
|
||||
pinExpiresAt: Date | null;
|
||||
isPendingSyncReset: boolean;
|
||||
|
|
@ -251,7 +251,7 @@ export type Person = {
|
|||
color: string | null;
|
||||
faceAssetId: string | null;
|
||||
isHidden: boolean;
|
||||
thumbnailPath: string;
|
||||
thumbnailPath: string | null;
|
||||
};
|
||||
|
||||
export type AssetFace = {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ export const PersonResponseSchema = z
|
|||
name: z.string().describe('Person name'),
|
||||
// TODO: use `isoDateToDate` when using `ZodSerializerDto` on the controllers.
|
||||
birthDate: z.string().meta({ format: 'date' }).describe('Person date of birth').nullable(),
|
||||
thumbnailPath: z.string().describe('Thumbnail path'),
|
||||
thumbnailPath: z.string().nullable().describe('Thumbnail path'),
|
||||
isHidden: z.boolean().describe('Is hidden'),
|
||||
// TODO: use `isoDatetimeToDate` when using `ZodSerializerDto` on the controllers.
|
||||
updatedAt: z
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import z from 'zod';
|
|||
const SessionCreateSchema = z
|
||||
.object({
|
||||
duration: z.int().min(1).optional().describe('Session duration in seconds'),
|
||||
deviceType: z.string().optional().describe('Device type'),
|
||||
deviceOS: z.string().optional().describe('Device OS'),
|
||||
deviceType: z.string().nullish().transform((val) => (val === '' ? null : val)).describe('Device type'),
|
||||
deviceOS: z.string().nullish().transform((val) => (val === '' ? null : val)).describe('Device OS'),
|
||||
})
|
||||
.meta({ id: 'SessionCreateDto' });
|
||||
|
||||
|
|
@ -23,8 +23,8 @@ const SessionResponseSchema = z
|
|||
updatedAt: z.string().describe('Last update date'),
|
||||
expiresAt: z.string().optional().describe('Expiration date'),
|
||||
current: z.boolean().describe('Is current session'),
|
||||
deviceType: z.string().describe('Device type'),
|
||||
deviceOS: z.string().describe('Device OS'),
|
||||
deviceType: z.string().nullable().describe('Device type'),
|
||||
deviceOS: z.string().nullable().describe('Device OS'),
|
||||
appVersion: z.string().nullable().describe('App version'),
|
||||
isPendingSyncReset: z.boolean().describe('Is pending sync reset'),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
import { Kysely, sql } from 'kysely';
|
||||
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
await sql`ALTER TABLE "session" ALTER COLUMN "deviceType" DROP NOT NULL;`.execute(db);
|
||||
await sql`ALTER TABLE "session" ALTER COLUMN "deviceType" SET DEFAULT NULL;`.execute(db);
|
||||
await sql`UPDATE "session" SET "deviceType" = NULL WHERE "deviceType" = '';`.execute(db);
|
||||
await sql`ALTER TABLE "session" ALTER COLUMN "deviceOS" DROP NOT NULL;`.execute(db);
|
||||
await sql`ALTER TABLE "session" ALTER COLUMN "deviceOS" SET DEFAULT NULL;`.execute(db);
|
||||
await sql`UPDATE "session" SET "deviceOS" = NULL WHERE "deviceOS" = '';`.execute(db);
|
||||
}
|
||||
|
||||
export async function down(): Promise<void> {
|
||||
await sql`UPDATE "session" SET "deviceOS" = '' WHERE "deviceOS" IS NULL;`.execute(db);
|
||||
await sql`ALTER TABLE "session" ALTER COLUMN "deviceOS" SET DEFAULT '';`.execute(db);
|
||||
await sql`ALTER TABLE "session" ALTER COLUMN "deviceOS" SET NOT NULL;`.execute(db);
|
||||
await sql`UPDATE "session" SET "deviceType" = '' WHERE "deviceType" IS NULL;`.execute(db);
|
||||
await sql`ALTER TABLE "session" ALTER COLUMN "deviceType" SET DEFAULT '';`.execute(db);
|
||||
await sql`ALTER TABLE "session" ALTER COLUMN "deviceType" SET NOT NULL;`.execute(db);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import { Kysely, sql } from 'kysely';
|
||||
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
await sql`ALTER TABLE "person" ALTER COLUMN "thumbnailPath" DROP NOT NULL;`.execute(db);
|
||||
await sql`ALTER TABLE "person" ALTER COLUMN "thumbnailPath" SET DEFAULT NULL;`.execute(db);
|
||||
await sql`UPDATE "person" SET "thumbnailPath" = NULL WHERE "thumbnailPath" = '';`.execute(db);
|
||||
}
|
||||
|
||||
export async function down(): Promise<void> {
|
||||
await sql`UPDATE "person" SET "thumbnailPath" = '' WHERE "thumbnailPath" IS NULL;`.execute(db);
|
||||
await sql`ALTER TABLE "person" ALTER COLUMN "thumbnailPath" SET DEFAULT '';`.execute(db);
|
||||
await sql`ALTER TABLE "person" ALTER COLUMN "thumbnailPath" SET NOT NULL;`.execute(db);
|
||||
}
|
||||
|
|
@ -46,8 +46,8 @@ export class PersonTable {
|
|||
@Column({ default: '' })
|
||||
name!: Generated<string>;
|
||||
|
||||
@Column({ default: '' })
|
||||
thumbnailPath!: Generated<string>;
|
||||
@Column({ nullable: true, default: null })
|
||||
thumbnailPath!: string | null;
|
||||
|
||||
@Column({ type: 'boolean', default: false })
|
||||
isHidden!: Generated<boolean>;
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ export class SessionTable {
|
|||
@ForeignKeyColumn(() => SessionTable, { onUpdate: 'CASCADE', onDelete: 'CASCADE', nullable: true })
|
||||
parentId!: string | null;
|
||||
|
||||
@Column({ default: '' })
|
||||
deviceType!: Generated<string>;
|
||||
@Column({ nullable: true, default: null })
|
||||
deviceType!: string | null;
|
||||
|
||||
@Column({ default: '' })
|
||||
deviceOS!: Generated<string>;
|
||||
@Column({ nullable: true, default: null })
|
||||
deviceOS!: string | null;
|
||||
|
||||
@Column({ nullable: true })
|
||||
appVersion!: string | null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue