mirror of
https://github.com/CaramelFur/Picsur.git
synced 2026-05-07 04:37:46 +02:00
add image list api
This commit is contained in:
9
shared/src/dto/api/common.dto.ts
Normal file
9
shared/src/dto/api/common.dto.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { z } from 'zod';
|
||||
import { createZodDto } from '../../util/create-zod-dto';
|
||||
import { IsPosInt } from '../../validators/positive-int.validator';
|
||||
|
||||
export const PagedRequestSchema = z.object({
|
||||
count: IsPosInt(),
|
||||
page: IsPosInt(),
|
||||
});
|
||||
export class PagedRequest extends createZodDto(PagedRequestSchema) {}
|
||||
16
shared/src/dto/api/image-manage.dto.ts
Normal file
16
shared/src/dto/api/image-manage.dto.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { z } from 'zod';
|
||||
import { EImageSchema } from '../../entities/image.entity';
|
||||
import { createZodDto } from '../../util/create-zod-dto';
|
||||
import { IsPosInt } from '../../validators/positive-int.validator';
|
||||
|
||||
export const ImageUploadResponseSchema = EImageSchema;
|
||||
export class ImageUploadResponse extends createZodDto(
|
||||
ImageUploadResponseSchema,
|
||||
) {}
|
||||
|
||||
export const ImageListResponseSchema = z.object({
|
||||
images: z.array(EImageSchema),
|
||||
count: IsPosInt(),
|
||||
page: IsPosInt(),
|
||||
});
|
||||
export class ImageListResponse extends createZodDto(ImageListResponseSchema) {}
|
||||
@@ -40,8 +40,3 @@ export const ImageMetaResponseSchema = z.object({
|
||||
}),
|
||||
});
|
||||
export class ImageMetaResponse extends createZodDto(ImageMetaResponseSchema) {}
|
||||
|
||||
export const ImageUploadResponseSchema = EImageSchema;
|
||||
export class ImageUploadResponse extends createZodDto(
|
||||
ImageUploadResponseSchema,
|
||||
) {}
|
||||
|
||||
@@ -8,12 +8,6 @@ import { IsStringList } from '../../validators/string-list.validator';
|
||||
import { EntityIDObjectSchema } from '../id-object.dto';
|
||||
|
||||
// UserList
|
||||
export const UserListRequestSchema = z.object({
|
||||
count: IsPosInt(),
|
||||
page: IsPosInt(),
|
||||
});
|
||||
export class UserListRequest extends createZodDto(UserListRequestSchema) {}
|
||||
|
||||
export const UserListResponseSchema = z.object({
|
||||
users: z.array(EUserSchema),
|
||||
count: IsPosInt(),
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// Config
|
||||
export enum ImageMime {
|
||||
QOI = 'image/x-qoi',
|
||||
JPEG = 'image/jpeg',
|
||||
PNG = 'image/png',
|
||||
WEBP = 'image/webp',
|
||||
TIFF = 'image/tiff',
|
||||
BMP = 'image/bmp',
|
||||
// ICO = 'image/x-icon',
|
||||
QOI = 'image/x-qoi',
|
||||
}
|
||||
|
||||
export enum AnimMime {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// -> the frontend and backend can be somewhat out of sync
|
||||
export enum Permission {
|
||||
ImageView = 'image-view',
|
||||
ImageUpload = 'image-upload',
|
||||
ImageUpload = 'image-upload', // Ability to upload and manage own images
|
||||
|
||||
UserLogin = 'user-login', // Ability to log in
|
||||
UserKeepLogin = 'user-keep-login', // Ability to view own user details and refresh token
|
||||
@@ -12,6 +12,7 @@ export enum Permission {
|
||||
|
||||
Settings = 'settings', // Ability to view (personal) settings
|
||||
|
||||
ImageManage = 'image-manage', // Ability to manage everyones manage images
|
||||
UserManage = 'user-manage', // Allow modification of users
|
||||
RoleManage = 'role-manage', // Allow modification of roles
|
||||
SysPrefManage = 'syspref-manage',
|
||||
|
||||
Reference in New Issue
Block a user