|
| 1 | +"use strict"; |
| 2 | +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { |
| 3 | + if (k2 === undefined) k2 = k; |
| 4 | + var desc = Object.getOwnPropertyDescriptor(m, k); |
| 5 | + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { |
| 6 | + desc = { enumerable: true, get: function() { return m[k]; } }; |
| 7 | + } |
| 8 | + Object.defineProperty(o, k2, desc); |
| 9 | +}) : (function(o, m, k, k2) { |
| 10 | + if (k2 === undefined) k2 = k; |
| 11 | + o[k2] = m[k]; |
| 12 | +})); |
| 13 | +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { |
| 14 | + Object.defineProperty(o, "default", { enumerable: true, value: v }); |
| 15 | +}) : function(o, v) { |
| 16 | + o["default"] = v; |
| 17 | +}); |
| 18 | +var __importStar = (this && this.__importStar) || (function () { |
| 19 | + var ownKeys = function(o) { |
| 20 | + ownKeys = Object.getOwnPropertyNames || function (o) { |
| 21 | + var ar = []; |
| 22 | + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; |
| 23 | + return ar; |
| 24 | + }; |
| 25 | + return ownKeys(o); |
| 26 | + }; |
| 27 | + return function (mod) { |
| 28 | + if (mod && mod.__esModule) return mod; |
| 29 | + var result = {}; |
| 30 | + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); |
| 31 | + __setModuleDefault(result, mod); |
| 32 | + return result; |
| 33 | + }; |
| 34 | +})(); |
| 35 | +Object.defineProperty(exports, "__esModule", { value: true }); |
| 36 | +exports.UserSchema = exports.ResponseSchema = exports.SurveySchema = void 0; |
| 37 | +const z = __importStar(require("zod")); |
| 38 | +exports.SurveySchema = z.object({ |
| 39 | + id: z.number().optional(), |
| 40 | + question: z.string().min(1, { message: "La question ne peut pas être vide" }), |
| 41 | + userId: z.number(), |
| 42 | + creator: z |
| 43 | + .object({ |
| 44 | + id: z.number(), |
| 45 | + nom: z.string(), |
| 46 | + prenom: z.string(), |
| 47 | + email: z.string().email(), |
| 48 | + role: z.string().default("user"), |
| 49 | + }) |
| 50 | + .optional(), |
| 51 | + response: z |
| 52 | + .array(z.object({ |
| 53 | + id: z.number(), |
| 54 | + userId: z.number(), |
| 55 | + surveyId: z.number(), |
| 56 | + reponse: z.string(), |
| 57 | + })) |
| 58 | + .optional(), |
| 59 | +}); |
| 60 | +exports.ResponseSchema = z.object({ |
| 61 | + id: z.number().optional(), |
| 62 | + userId: z.number(), |
| 63 | + surveyId: z.number(), |
| 64 | + reponse: z.string().min(1, { message: "La réponse ne peut pas être vide" }), |
| 65 | +}); |
| 66 | +exports.UserSchema = z.object({ |
| 67 | + id: z.number().optional(), |
| 68 | + nom: z.string().min(1), |
| 69 | + prenom: z.string().min(1), |
| 70 | + email: z.string().email(), |
| 71 | + password: z.string().min(6), |
| 72 | + confirm_password: z.string().min(6), |
| 73 | + role: z.string().optional(), |
| 74 | + createdSurvey: z.array(exports.SurveySchema).optional(), |
| 75 | + responses: z.array(exports.ResponseSchema).optional(), |
| 76 | +}); |
0 commit comments