Skip to content

Commit

Permalink
feat(api): add expand schema
Browse files Browse the repository at this point in the history
Co-authored-by: Yann Bertrand <[email protected]>
Co-authored-by: Diane Cordier <[email protected]>
  • Loading branch information
3 people committed Dec 20, 2024
1 parent 586a277 commit 46a0d93
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Joi from 'joi';

import { htmlSchema, uuidSchema } from '../utils.js';

const expandElementSchema = Joi.object({
id: uuidSchema,
type: Joi.string().valid('expand').required(),
title: Joi.string().required(),
content: htmlSchema.required(),
}).required();

export { expandElementSchema };
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Joi from 'joi';

import { downloadElementSchema } from './element/download-schema.js';
import { embedElementSchema } from './element/embed-schema.js';
import { expandElementSchema } from './element/expand-schema.js';
import { flashcardsElementSchema } from './element/flashcards-schema.js';
import { imageElementSchema } from './element/image-schema.js';
import { qcmElementSchema } from './element/qcm-schema.js';
Expand Down Expand Up @@ -30,6 +31,7 @@ const elementSchema = Joi.alternatives().conditional('.type', {
switch: [
{ is: 'download', then: downloadElementSchema },
{ is: 'embed', then: embedElementSchema },
{ is: 'expand', then: expandElementSchema },
{ is: 'flashcards', then: flashcardsElementSchema },
{ is: 'image', then: imageElementSchema },
{ is: 'qcu', then: qcuElementSchema },
Expand All @@ -44,6 +46,7 @@ const elementSchema = Joi.alternatives().conditional('.type', {
const stepperElementSchema = Joi.alternatives().conditional('.type', {
switch: [
{ is: 'download', then: downloadElementSchema },
{ is: 'expand', then: expandElementSchema },
{ is: 'image', then: imageElementSchema },
{ is: 'qcu', then: qcuElementSchema },
{ is: 'qcm', then: qcmElementSchema },
Expand Down

0 comments on commit 46a0d93

Please sign in to comment.