Reorganize app workspaces and align Admin architecture
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import vine from '@vinejs/vine'
|
||||
|
||||
export const createAdminValidator = vine.compile(
|
||||
vine.object({
|
||||
id: vine.number().optional(),
|
||||
email: vine
|
||||
.string()
|
||||
.trim()
|
||||
.email()
|
||||
.unique(async (db, value) => {
|
||||
const exists = await db.from('admins').where('email', value).first()
|
||||
return !exists
|
||||
}),
|
||||
password: vine.string().trim().minLength(8),
|
||||
firstName: vine.string().trim().optional(),
|
||||
lastName: vine.string().trim().optional(),
|
||||
status: vine.enum(['active', 'inactive']),
|
||||
roles: vine.array(vine.number()),
|
||||
})
|
||||
)
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import vine from '@vinejs/vine'
|
||||
|
||||
export const updateProfileAdminValidator = vine.compile(
|
||||
vine.object({
|
||||
id: vine.number(),
|
||||
email: vine
|
||||
.string()
|
||||
.trim()
|
||||
.email()
|
||||
.unique(async (db, value, field) => {
|
||||
const id = field.data.id
|
||||
const exists = await db.from('admins').where('email', value).whereNot('id', id).first()
|
||||
return !exists
|
||||
}),
|
||||
password: vine.string().trim().minLength(8).optional(),
|
||||
firstName: vine.string().trim().minLength(1),
|
||||
lastName: vine.string().trim().minLength(1),
|
||||
status: vine.enum(['active', 'inactive']).optional(),
|
||||
})
|
||||
)
|
||||
@@ -0,0 +1,22 @@
|
||||
import vine from '@vinejs/vine'
|
||||
|
||||
export const updateAdminValidator = vine.compile(
|
||||
vine.object({
|
||||
id: vine.number().optional(),
|
||||
email: vine
|
||||
.string()
|
||||
.trim()
|
||||
.email()
|
||||
.unique(async (db, value, field) => {
|
||||
const id = field.data.id
|
||||
const exists = await db.from('admins').where('email', value).whereNot('id', id).first()
|
||||
return !exists
|
||||
})
|
||||
.optional(),
|
||||
password: vine.string().trim().minLength(8).optional(),
|
||||
firstName: vine.string().trim().optional(),
|
||||
lastName: vine.string().trim().optional(),
|
||||
status: vine.enum(['active', 'inactive']).optional(),
|
||||
roles: vine.array(vine.number()),
|
||||
})
|
||||
)
|
||||
Reference in New Issue
Block a user