mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
refactor: better types for getList and getDeletedAfter (#16926)
This commit is contained in:
parent
93907a89d8
commit
6a40aa83b7
13 changed files with 342 additions and 194 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { sql } from 'kysely';
|
||||
import { AssetStatus, AssetType, Permission } from 'src/enum';
|
||||
import { UserMetadataEntity } from 'src/entities/user-metadata.entity';
|
||||
import { AssetStatus, AssetType, Permission, UserStatus } from 'src/enum';
|
||||
|
||||
export type AuthUser = {
|
||||
id: string;
|
||||
|
|
@ -46,6 +46,20 @@ export type User = {
|
|||
profileChangedAt: Date;
|
||||
};
|
||||
|
||||
export type UserAdmin = User & {
|
||||
storageLabel: string | null;
|
||||
shouldChangePassword: boolean;
|
||||
isAdmin: boolean;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
deletedAt: Date | null;
|
||||
oauthId: string;
|
||||
quotaSizeInBytes: number | null;
|
||||
quotaUsageInBytes: number;
|
||||
status: UserStatus;
|
||||
metadata: UserMetadataEntity[];
|
||||
};
|
||||
|
||||
export type Asset = {
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
|
|
@ -103,9 +117,9 @@ export type Partner = {
|
|||
inTimeline: boolean;
|
||||
};
|
||||
|
||||
const userColumns = ['id', 'name', 'email', 'profileImagePath', 'profileChangedAt'] as const;
|
||||
|
||||
export const columns = {
|
||||
ackEpoch: (columnName: 'createdAt' | 'updatedAt' | 'deletedAt') =>
|
||||
sql.raw<string>(`extract(epoch from "${columnName}")::text`).as('ackEpoch'),
|
||||
authUser: [
|
||||
'users.id',
|
||||
'users.name',
|
||||
|
|
@ -125,7 +139,21 @@ export const columns = {
|
|||
'shared_links.allowDownload',
|
||||
'shared_links.password',
|
||||
],
|
||||
userDto: ['id', 'name', 'email', 'profileImagePath', 'profileChangedAt'],
|
||||
user: userColumns,
|
||||
userAdmin: [
|
||||
...userColumns,
|
||||
'createdAt',
|
||||
'updatedAt',
|
||||
'deletedAt',
|
||||
'isAdmin',
|
||||
'status',
|
||||
'oauthId',
|
||||
'profileImagePath',
|
||||
'shouldChangePassword',
|
||||
'storageLabel',
|
||||
'quotaSizeInBytes',
|
||||
'quotaUsageInBytes',
|
||||
],
|
||||
tagDto: ['id', 'value', 'createdAt', 'updatedAt', 'color', 'parentId'],
|
||||
apiKey: ['id', 'name', 'userId', 'createdAt', 'updatedAt', 'permissions'],
|
||||
syncAsset: [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue