forked from premieroctet/openchakra
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sosynpl[premieroctet#153] added contact form
- Loading branch information
1 parent
95b2b68
commit 60e5998
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
backend/web/server/plugins/sosynpl/schemas/ContactSchema.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const mongoose = require("mongoose") | ||
const { schemaOptions } = require('../../../utils/schemas') | ||
const { isEmailOk, isPhoneOk } = require('../../../../utils/sms') | ||
|
||
const Schema = mongoose.Schema; | ||
|
||
const CompanySchema = new Schema({ | ||
firstname: { | ||
type: String, | ||
required: [true, 'Le prénom est obligatoire'] | ||
}, | ||
lastname: { | ||
type: String, | ||
required: [true, 'Le nom est obligatoire'] | ||
}, | ||
company_name: String, | ||
email: { | ||
type: String, | ||
validate: [isEmailOk, "L'email est invalide"], | ||
required: [true, "L'email est obligatoire"] | ||
}, | ||
phone: { | ||
type: String, | ||
validate: [isPhoneOk, 'Le numéro de téléphone doit commencer par 0 ou +33'], | ||
required: [true, 'Le téléphone est obligatoire'] | ||
}, | ||
message: { | ||
type: String, | ||
required: [true, 'Le message est obligatoire'] | ||
}, | ||
subject: { | ||
type: String, | ||
required: [true, 'Le sujet est obligatoire'] | ||
}, | ||
document: { | ||
type: String, | ||
required: false, | ||
}, | ||
treated: { | ||
type: Boolean, | ||
default: false, | ||
required: [true, 'Le statut est obligatoire'] | ||
} | ||
}, schemaOptions) | ||
|
||
module.exports = CompanySchema; |