mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 20:19:26 +01:00
Working on new version of website
Signed-off-by: Arthur DANJOU <arthurdanjou@outlook.fr>
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
import {rules, schema} from '@ioc:Adonis/Core/Validator'
|
||||
|
||||
export default class AuthValidator {
|
||||
constructor (private ctx: HttpContextContract) {
|
||||
public messages = {
|
||||
required: 'The field {{field}} is required'
|
||||
}
|
||||
|
||||
public schema = schema.create({
|
||||
@@ -16,11 +17,6 @@ export default class AuthValidator {
|
||||
remember_me: schema.boolean()
|
||||
})
|
||||
|
||||
public cacheKey = this.ctx.routeKey
|
||||
|
||||
public messages = {
|
||||
'email.email': 'L\'adresse mail n\'est pas valide !',
|
||||
'email.required': 'Veuillez renseigner une adresse mail !',
|
||||
'password.required': 'Veuillez renseigner un mot de passe !',
|
||||
constructor (protected ctx: HttpContextContract) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
import { schema } from '@ioc:Adonis/Core/Validator'
|
||||
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
|
||||
|
||||
export default class FormValidator {
|
||||
constructor (protected ctx: HttpContextContract) {
|
||||
}
|
||||
|
||||
public schema = schema.create({
|
||||
name: schema.string(),
|
||||
email: schema.string(),
|
||||
subject: schema.string(),
|
||||
content: schema.string()
|
||||
})
|
||||
|
||||
public messages = {}
|
||||
}
|
||||
15
app/Validators/announce/AnnounceStoreValidator.ts
Normal file
15
app/Validators/announce/AnnounceStoreValidator.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import {schema} from '@ioc:Adonis/Core/Validator'
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
|
||||
export default class AnnounceStoreValidator {
|
||||
public schema = schema.create({
|
||||
code: schema.string(),
|
||||
cover: schema.string.optional()
|
||||
})
|
||||
public messages = {
|
||||
required: 'The field {{ field }} is required'
|
||||
}
|
||||
|
||||
constructor (protected ctx: HttpContextContract) {
|
||||
}
|
||||
}
|
||||
15
app/Validators/announce/AnnounceUpdateValidator.ts
Normal file
15
app/Validators/announce/AnnounceUpdateValidator.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import {schema} from '@ioc:Adonis/Core/Validator'
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
|
||||
export default class AnnounceUpdateValidator {
|
||||
public schema = schema.create({
|
||||
code: schema.string.optional(),
|
||||
cover: schema.string.optional()
|
||||
})
|
||||
public messages = {
|
||||
required: 'The field {{field}} is required'
|
||||
}
|
||||
|
||||
constructor (protected ctx: HttpContextContract) {
|
||||
}
|
||||
}
|
||||
18
app/Validators/form/FormStoreValidator.ts
Executable file
18
app/Validators/form/FormStoreValidator.ts
Executable file
@@ -0,0 +1,18 @@
|
||||
import {schema} from '@ioc:Adonis/Core/Validator'
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
|
||||
export default class FormStoreValidator {
|
||||
constructor (protected ctx: HttpContextContract) {
|
||||
}
|
||||
|
||||
public schema = schema.create({
|
||||
name: schema.string(),
|
||||
email: schema.string(),
|
||||
subject: schema.string(),
|
||||
content: schema.string()
|
||||
})
|
||||
|
||||
public messages = {
|
||||
required: 'The field {{field}} is required'
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,9 @@ import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
import {rules, schema} from '@ioc:Adonis/Core/Validator'
|
||||
|
||||
export default class GuestValidator {
|
||||
constructor (private ctx: HttpContextContract) {
|
||||
public messages = {
|
||||
required: 'The field {{field}} is required',
|
||||
'email.email': 'The email is not correct'
|
||||
}
|
||||
|
||||
public schema = schema.create({
|
||||
@@ -14,9 +16,6 @@ export default class GuestValidator {
|
||||
])
|
||||
})
|
||||
|
||||
public cacheKey = this.ctx.routeKey
|
||||
|
||||
public messages = {
|
||||
required: 'Le champ {{field}} doit être valide !',
|
||||
constructor (protected ctx: HttpContextContract) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
import {schema} from '@ioc:Adonis/Core/Validator'
|
||||
|
||||
export default class LocationValidator {
|
||||
@@ -14,6 +14,6 @@ export default class LocationValidator {
|
||||
public cacheKey = this.ctx.routeKey
|
||||
|
||||
public messages = {
|
||||
required: 'Le champ {{field}} doit être valide !',
|
||||
required: 'The field {{field}} is required'
|
||||
}
|
||||
}
|
||||
|
||||
16
app/Validators/profile/ProfileUpdateValidator.ts
Normal file
16
app/Validators/profile/ProfileUpdateValidator.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import {schema} from '@ioc:Adonis/Core/Validator'
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
|
||||
export default class ProfileUpdateValidator {
|
||||
public schema = schema.create({
|
||||
age: schema.number.optional(),
|
||||
hiring_status: schema.string.optional(),
|
||||
hiring_color: schema.string.optional()
|
||||
})
|
||||
public messages = {
|
||||
required: 'The field {{field}} is required'
|
||||
}
|
||||
|
||||
constructor (protected ctx: HttpContextContract) {
|
||||
}
|
||||
}
|
||||
19
app/Validators/project/ProjectStoreValidator.ts
Executable file
19
app/Validators/project/ProjectStoreValidator.ts
Executable file
@@ -0,0 +1,19 @@
|
||||
import {schema} from '@ioc:Adonis/Core/Validator'
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
|
||||
export default class ProjectStoreValidator {
|
||||
constructor (protected ctx: HttpContextContract) {
|
||||
}
|
||||
|
||||
public schema = schema.create({
|
||||
name: schema.string(),
|
||||
description: schema.string(),
|
||||
progress: schema.number(),
|
||||
url: schema.string(),
|
||||
cover: schema.string()
|
||||
})
|
||||
|
||||
public messages = {
|
||||
required: 'The field {{field}} is required'
|
||||
}
|
||||
}
|
||||
18
app/Validators/project/ProjectUpdateValidator.ts
Normal file
18
app/Validators/project/ProjectUpdateValidator.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import {schema} from '@ioc:Adonis/Core/Validator'
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
|
||||
export default class ProjectUpdateValidator {
|
||||
public schema = schema.create({
|
||||
name: schema.string.optional(),
|
||||
description: schema.string.optional(),
|
||||
progress: schema.number.optional(),
|
||||
url: schema.string.optional(),
|
||||
cover: schema.string.optional()
|
||||
})
|
||||
public messages = {
|
||||
required: 'The field {{field}} is required'
|
||||
}
|
||||
|
||||
constructor (protected ctx: HttpContextContract) {
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
import { schema } from '@ioc:Adonis/Core/Validator'
|
||||
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
|
||||
|
||||
export default class ProjectValidator {
|
||||
constructor (protected ctx: HttpContextContract) {
|
||||
}
|
||||
|
||||
public schema = schema.create({
|
||||
name: schema.string(),
|
||||
description: schema.string(),
|
||||
progress: schema.number(),
|
||||
url: schema.string()
|
||||
})
|
||||
|
||||
|
||||
public messages = {
|
||||
required: 'Le champ {{field}} doit être valide !',
|
||||
}
|
||||
}
|
||||
20
app/Validators/subscriber/SubscriberStoreValidator.ts
Executable file
20
app/Validators/subscriber/SubscriberStoreValidator.ts
Executable file
@@ -0,0 +1,20 @@
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
import {rules, schema} from '@ioc:Adonis/Core/Validator'
|
||||
|
||||
export default class SubscriberStoreValidator {
|
||||
public schema = schema.create({
|
||||
email: schema.string({ trim: true }, [
|
||||
rules.email(),
|
||||
rules.unique({
|
||||
table: 'subscribers',
|
||||
column: 'email'
|
||||
})
|
||||
])
|
||||
})
|
||||
public messages = {
|
||||
required: 'The field {{field}} is required'
|
||||
}
|
||||
|
||||
constructor (protected ctx: HttpContextContract) {
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
import {rules, schema} from '@ioc:Adonis/Core/Validator'
|
||||
|
||||
export default class SubscriberValidator {
|
||||
constructor (private ctx: HttpContextContract) {
|
||||
}
|
||||
|
||||
public schema = schema.create({
|
||||
email: schema.string({ trim: true }, [
|
||||
rules.email()
|
||||
])
|
||||
})
|
||||
|
||||
public cacheKey = this.ctx.routeKey
|
||||
|
||||
public messages = {
|
||||
required: 'Le champ {{field}} doit être valide !',
|
||||
}
|
||||
}
|
||||
22
app/Validators/translation/TranslationStoreValidator.ts
Normal file
22
app/Validators/translation/TranslationStoreValidator.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import {rules, schema} from '@ioc:Adonis/Core/Validator'
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
|
||||
export default class TranslationStoreValidator {
|
||||
public schema = schema.create({
|
||||
code: schema.string({}, [
|
||||
rules.unique({
|
||||
table: 'translations',
|
||||
column: 'code'
|
||||
})
|
||||
]),
|
||||
english: schema.string.optional(),
|
||||
french: schema.string.optional()
|
||||
})
|
||||
public messages = {
|
||||
required: 'The field {{field}} is required',
|
||||
'code.unique': 'The translation code is not unique !'
|
||||
}
|
||||
|
||||
constructor (protected ctx: HttpContextContract) {
|
||||
}
|
||||
}
|
||||
22
app/Validators/translation/TranslationUpdateValidator.ts
Normal file
22
app/Validators/translation/TranslationUpdateValidator.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import {rules, schema} from '@ioc:Adonis/Core/Validator'
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
|
||||
export default class TranslationUpdateValidator {
|
||||
public schema = schema.create({
|
||||
code: schema.string({}, [
|
||||
rules.unique({
|
||||
table: 'translations',
|
||||
column: 'code'
|
||||
})
|
||||
]),
|
||||
english: schema.string.optional(),
|
||||
french: schema.string.optional()
|
||||
})
|
||||
public messages = {
|
||||
required: 'The field {{field}} is required',
|
||||
'code.unique': 'The translation code is not unique !'
|
||||
}
|
||||
|
||||
constructor (protected ctx: HttpContextContract) {
|
||||
}
|
||||
}
|
||||
23
app/Validators/user/UserStoreValidator.ts
Executable file
23
app/Validators/user/UserStoreValidator.ts
Executable file
@@ -0,0 +1,23 @@
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
import {rules, schema} from '@ioc:Adonis/Core/Validator'
|
||||
|
||||
export default class UserStoreValidator {
|
||||
public schema = schema.create({
|
||||
email: schema.string({ trim: true, escape: true }, [
|
||||
rules.email(),
|
||||
rules.required(),
|
||||
rules.unique({
|
||||
table: 'users',
|
||||
column: 'email'
|
||||
})
|
||||
])
|
||||
})
|
||||
public messages = {
|
||||
required: 'The field {{field}} is required',
|
||||
'email.email': 'The email must be valid',
|
||||
'email.unique': 'The email is not unique'
|
||||
}
|
||||
|
||||
constructor (protected ctx: HttpContextContract) {
|
||||
}
|
||||
}
|
||||
33
app/Validators/user/UserUpdateValidator.ts
Executable file
33
app/Validators/user/UserUpdateValidator.ts
Executable file
@@ -0,0 +1,33 @@
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
import {rules, schema} from '@ioc:Adonis/Core/Validator'
|
||||
|
||||
export default class UserUpdateValidator {
|
||||
public schema = schema.create({
|
||||
email: schema.string.optional({ trim: true, escape: true },
|
||||
[
|
||||
rules.email(),
|
||||
rules.unique(
|
||||
{
|
||||
table: 'users',
|
||||
column: 'email'
|
||||
})
|
||||
]
|
||||
),
|
||||
password: schema.string.optional({ trim: true, escape: true },
|
||||
[
|
||||
rules.confirmed()
|
||||
]
|
||||
),
|
||||
is_confirmed: schema.boolean.optional(),
|
||||
confirmation_token: schema.string.optional({ trim: true, escape: true }),
|
||||
remember_me: schema.string.optional({ trim: true, escape: true }),
|
||||
})
|
||||
public messages = {
|
||||
required: 'The field {{field}} is required',
|
||||
'email.email': 'The email must be valid',
|
||||
'password.confirmation': 'Passwords are not the same'
|
||||
}
|
||||
|
||||
constructor (protected ctx: HttpContextContract) {
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
|
||||
import {rules, schema} from '@ioc:Adonis/Core/Validator'
|
||||
|
||||
export default class UserStoreValidator {
|
||||
constructor (private ctx: HttpContextContract) {
|
||||
}
|
||||
|
||||
public schema = schema.create({
|
||||
email: schema.string({ trim: true, escape: true }, [
|
||||
rules.email(),
|
||||
rules.required(),
|
||||
rules.unique({table: 'users', column: 'email'})
|
||||
])
|
||||
})
|
||||
|
||||
public cacheKey = this.ctx.routeKey
|
||||
|
||||
public messages = {
|
||||
required: 'Le champ {{field}} doit être valide !',
|
||||
'email.email': 'L\'adresse mail doit être valide !',
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
import {rules, schema} from '@ioc:Adonis/Core/Validator'
|
||||
|
||||
export default class UserUpdateValidator {
|
||||
constructor (private ctx: HttpContextContract) {
|
||||
}
|
||||
|
||||
public schema = schema.create({
|
||||
email: schema.string.optional({trim: true, escape: true}, [rules.email(), rules.unique({
|
||||
table: 'users', column: 'email'
|
||||
})]),
|
||||
password: schema.string.optional({trim: true, escape: true}, [rules.confirmed()]),
|
||||
is_confirmed: schema.boolean.optional(),
|
||||
confirmation_token: schema.string.optional({trim: true, escape: true}),
|
||||
remember_me: schema.string.optional({trim: true, escape: true}),
|
||||
})
|
||||
|
||||
public cacheKey = this.ctx.routeKey
|
||||
|
||||
public messages = {
|
||||
required: 'Le champ {{field}} doit être valide !',
|
||||
'email.email': 'L\'adresse mail doit être valide !',
|
||||
'password.confirmation': 'Les mots de passe ne correspondent pas !'
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user