Add initial project files

This commit is contained in:
Igor Martyniuk
2026-09-01 13:03:41 +03:00
parent 22e111bb44
commit 74cb5b6176
1841 changed files with 242819 additions and 30 deletions
@@ -0,0 +1,23 @@
import { VineMultipartFile } from '@adonisjs/core/vine'
import { OptionalModifier } from '@vinejs/vine/schema/base/literal'
import vine from '@vinejs/vine'
/**
* Creates a reusable upload file schema that requires either:
* - `ref` (reference to an existing file), or
* - `file` (new uploaded file).
*
* At least one field must be present. When `ref` is missing, `file`
* becomes required. When `file` is missing, `ref` becomes required.
*
* @param fileScheme Custom optional file validation schema.
* @returns Vine object schema with mutually dependent `ref` and `file` fields.
*/
export default function createFileInputSchema(
fileScheme: OptionalModifier<VineMultipartFile> = vine.file({ size: '5mb' }).optional()
) {
return vine.object({
ref: vine.string().optional().requiredIfMissing('file'),
file: fileScheme.requiredIfMissing('ref'),
})
}
@@ -0,0 +1,13 @@
import vine from '@vinejs/vine'
export type JsonValue =
| string
| number
| boolean
| null
| JsonValue[]
| { [key: string]: JsonValue }
export type JsonObject = Record<string, JsonValue>
export const jsonObjectSchema = vine.object({}).allowUnknownProperties<JsonValue>()