Skip to content

Commit

Permalink
Sosynpl[premieroctet#153] added contact form
Browse files Browse the repository at this point in the history
  • Loading branch information
SeghirOumo committed Jul 26, 2024
1 parent 95b2b68 commit 60e5998
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions backend/web/server/plugins/sosynpl/schemas/ContactSchema.js
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;

0 comments on commit 60e5998

Please sign in to comment.