mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 23:15:36 +00:00
feat: add multiple way to show collections and links
This commit is contained in:
26
app/user/validators/update_display_preferences.ts
Normal file
26
app/user/validators/update_display_preferences.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import {
|
||||
COLLECTION_LIST_DISPLAYS,
|
||||
DEFAULT_LIST_DISPLAY_PREFERENCES,
|
||||
LINK_LIST_DISPLAYS,
|
||||
} from '#shared/lib/display_preferences';
|
||||
import vine from '@vinejs/vine';
|
||||
|
||||
export const updateDisplayPreferencesValidator = vine.compile(
|
||||
vine.object({
|
||||
displayPreferences: vine.object({
|
||||
linkListDisplay: vine
|
||||
.enum(LINK_LIST_DISPLAYS)
|
||||
.optional()
|
||||
.transform(
|
||||
(value) => value ?? DEFAULT_LIST_DISPLAY_PREFERENCES.linkListDisplay
|
||||
),
|
||||
collectionListDisplay: vine
|
||||
.enum(COLLECTION_LIST_DISPLAYS)
|
||||
.optional()
|
||||
.transform(
|
||||
(value) =>
|
||||
value ?? DEFAULT_LIST_DISPLAY_PREFERENCES.collectionListDisplay
|
||||
),
|
||||
}),
|
||||
})
|
||||
);
|
||||
Reference in New Issue
Block a user