tethys.backend/app/validators/project.ts
Arno Kaimbacher 3d8f2354cb
Some checks failed
build.yaml / feat: Enhance Dataset Edit Page with Unsaved Changes Indicator and Improved Structure (push) Failing after 0s
feat: Enhance Dataset Edit Page with Unsaved Changes Indicator and Improved Structure
- Added a progress indicator for unsaved changes at the top of the dataset edit page.
- Enhanced the title section with a dataset status badge and improved layout.
- Introduced collapsible sections for better organization of form fields.
- Improved notifications for success/error messages.
- Refactored form fields into distinct sections: Basic Information, Licenses, Titles, Descriptions, Creators & Contributors, Additional Metadata, Geographic Coverage, and Files.
- Enhanced loading spinner with a more visually appealing overlay.
- Added new project validation logic in the backend with create and update validators.
2025-10-29 11:20:27 +01:00

28 lines
810 B
TypeScript

// app/validators/project.ts
import vine from '@vinejs/vine';
export const createProjectValidator = vine.compile(
vine.object({
label: vine.string().trim().minLength(1).maxLength(50),
name: vine
.string()
.trim()
.minLength(3)
.maxLength(255)
.regex(/^[a-z0-9-]+$/),
description: vine.string().trim().maxLength(255).minLength(5).optional(),
}),
);
export const updateProjectValidator = vine.compile(
vine.object({
// label is NOT included since it's readonly
name: vine
.string()
.trim()
.minLength(3)
.maxLength(255)
.regex(/^[a-z0-9-]+$/),
description: vine.string().trim().maxLength(255).minLength(5).optional(),
}),
);