mirror of
https://github.com/CaramelFur/Picsur.git
synced 2026-05-07 02:17:29 +02:00
add userprefrerencedb
This commit is contained in:
@@ -10,15 +10,21 @@ export const PrefValueTypes = tuple('string', 'number', 'boolean');
|
||||
|
||||
// Decoded Representations
|
||||
|
||||
export const DecodedSysPrefSchema = z.object({
|
||||
export const DecodedPrefSchema = z.object({
|
||||
key: z.string(),
|
||||
value: IsPrefValue(),
|
||||
type: z.enum(PrefValueTypes),
|
||||
})
|
||||
});
|
||||
export type DecodedPref = z.infer<typeof DecodedSysPrefSchema>;
|
||||
|
||||
// Usr and Sys
|
||||
|
||||
export const DecodedSysPrefSchema = DecodedPrefSchema;
|
||||
export type DecodedSysPref = z.infer<typeof DecodedSysPrefSchema>;
|
||||
|
||||
export const DecodedUsrPrefSchema = DecodedSysPrefSchema.merge(z.object({
|
||||
user: IsEntityID(),
|
||||
}))
|
||||
export const DecodedUsrPrefSchema = DecodedSysPrefSchema.merge(
|
||||
z.object({
|
||||
user: IsEntityID(),
|
||||
}),
|
||||
);
|
||||
export type DecodedUsrPref = z.infer<typeof DecodedUsrPrefSchema>;
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import { z } from 'zod';
|
||||
import { IsEntityID } from '../validators/entity-id.validator';
|
||||
|
||||
export const ESysPreferenceSchema = z.object({
|
||||
id: IsEntityID().optional(),
|
||||
key: z.string(),
|
||||
value: z.string(),
|
||||
});
|
||||
export type ESysPreference = z.infer<typeof ESysPreferenceSchema>;
|
||||
@@ -1,11 +0,0 @@
|
||||
import { z } from 'zod';
|
||||
import { IsEntityID } from '../validators/entity-id.validator';
|
||||
import { IsPosInt } from '../validators/positive-int.validator';
|
||||
|
||||
export const EUsrPreferenceSchema = z.object({
|
||||
id: IsEntityID().optional(),
|
||||
key: z.string(),
|
||||
value: z.string(),
|
||||
userId: IsPosInt(),
|
||||
})
|
||||
export type EUsrPreference = z.infer<typeof EUsrPreferenceSchema>;
|
||||
Reference in New Issue
Block a user