-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TECH] Ecrire le contenu pédagogique dans la base de données PG dans …
- Loading branch information
Showing
157 changed files
with
1,085 additions
and
1,132 deletions.
There are no files selected for viewing
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
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
25 changes: 25 additions & 0 deletions
25
api/db/database-builder/factory/learning-content/build-area.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,25 @@ | ||
import { databaseBuffer } from '../../database-buffer.js'; | ||
|
||
export function buildArea({ | ||
id = 'areaIdA', | ||
code = 'code Domaine A', | ||
name = 'name Domaine A', | ||
title_i18n = { fr: 'title FR Domaine A', en: 'title EN Domaine A' }, | ||
color = 'color Domaine A', | ||
frameworkId = 'frameworkPix', | ||
competenceIds = ['competenceIdA'], | ||
} = {}) { | ||
const values = { | ||
id, | ||
code, | ||
name, | ||
title_i18n, | ||
color, | ||
frameworkId, | ||
competenceIds, | ||
}; | ||
return databaseBuffer.pushInsertable({ | ||
tableName: 'learningcontent.areas', | ||
values, | ||
}); | ||
} |
85 changes: 85 additions & 0 deletions
85
api/db/database-builder/factory/learning-content/build-challenge.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,85 @@ | ||
import { databaseBuffer } from '../../database-buffer.js'; | ||
|
||
export function buildChallenge({ | ||
id = 'challengeIdA', | ||
instruction = 'instruction Epreuve A', | ||
alternativeInstruction = 'alternativeInstruction Epreuve A', | ||
proposals = 'proposals Epreuve A', | ||
type = 'QCU', | ||
solution = 'solution Epreuve A', | ||
solutionToDisplay = 'solutionToDisplay Epreuve A', | ||
t1Status = true, | ||
t2Status = true, | ||
t3Status = true, | ||
status = 'archivé', | ||
genealogy = 'genealogy Epreuve A', | ||
accessibility1 = 'accessibility1 Epreuve A', | ||
accessibility2 = 'accessibility2 Epreuve B', | ||
requireGafamWebsiteAccess = true, | ||
isIncompatibleIpadCertif = true, | ||
deafAndHardOfHearing = 'deafAndHardOfHearing Epreuve A', | ||
isAwarenessChallenge = true, | ||
toRephrase = true, | ||
alternativeVersion = 8, | ||
shuffled = true, | ||
illustrationAlt = 'illustrationAlt Epreuve A', | ||
illustrationUrl = 'illustrationUrl Epreuve A', | ||
attachments = ['attachment1', 'attachment2'], | ||
responsive = 'responsive Epreuve A', | ||
alpha = 1.1, | ||
delta = 3.3, | ||
autoReply = true, | ||
focusable = true, | ||
format = 'format Epreuve A', | ||
timer = 180, | ||
embedHeight = 800, | ||
embedUrl = 'embedUrl Epreuve A', | ||
embedTitle = 'embedTitle Epreuve A', | ||
locales = ['fr'], | ||
competenceId = 'competenceIdA', | ||
skillId = 'skillIdA', | ||
} = {}) { | ||
const values = { | ||
id, | ||
instruction, | ||
alternativeInstruction, | ||
proposals, | ||
type, | ||
solution, | ||
solutionToDisplay, | ||
t1Status, | ||
t2Status, | ||
t3Status, | ||
status, | ||
genealogy, | ||
accessibility1, | ||
accessibility2, | ||
requireGafamWebsiteAccess, | ||
isIncompatibleIpadCertif, | ||
deafAndHardOfHearing, | ||
isAwarenessChallenge, | ||
toRephrase, | ||
alternativeVersion, | ||
shuffled, | ||
illustrationAlt, | ||
illustrationUrl, | ||
attachments, | ||
responsive, | ||
alpha, | ||
delta, | ||
autoReply, | ||
focusable, | ||
format, | ||
timer, | ||
embedHeight, | ||
embedUrl, | ||
embedTitle, | ||
locales, | ||
competenceId, | ||
skillId, | ||
}; | ||
return databaseBuffer.pushInsertable({ | ||
tableName: 'learningcontent.challenges', | ||
values, | ||
}); | ||
} |
27 changes: 27 additions & 0 deletions
27
api/db/database-builder/factory/learning-content/build-competence.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,27 @@ | ||
import { databaseBuffer } from '../../database-buffer.js'; | ||
|
||
export function buildCompetence({ | ||
id = 'competenceIdA', | ||
name_i18n = { fr: 'name FR Compétence A', en: 'name EN Compétence A' }, | ||
description_i18n = { fr: 'description FR Compétence A', en: 'description EN Compétence A' }, | ||
index = 'index Compétence A', | ||
origin = 'origin Compétence A', | ||
areaId = 'areaIdA', | ||
skillIds = ['skillIdA'], | ||
thematicIds = ['thematicIdA'], | ||
} = {}) { | ||
const values = { | ||
id, | ||
name_i18n, | ||
description_i18n, | ||
index, | ||
origin, | ||
areaId, | ||
skillIds, | ||
thematicIds, | ||
}; | ||
return databaseBuffer.pushInsertable({ | ||
tableName: 'learningcontent.competences', | ||
values, | ||
}); | ||
} |
23 changes: 23 additions & 0 deletions
23
api/db/database-builder/factory/learning-content/build-course.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,23 @@ | ||
import { databaseBuffer } from '../../database-buffer.js'; | ||
|
||
export function buildCourse({ | ||
id = 'courseIdA', | ||
name = 'instruction Test Statique A', | ||
description = 'description Test Statique A', | ||
isActive = true, | ||
competences = ['competenceIdA'], | ||
challenges = ['challengeIdA'], | ||
} = {}) { | ||
const values = { | ||
id, | ||
name, | ||
description, | ||
isActive, | ||
competences, | ||
challenges, | ||
}; | ||
return databaseBuffer.pushInsertable({ | ||
tableName: 'learningcontent.courses', | ||
values, | ||
}); | ||
} |
12 changes: 12 additions & 0 deletions
12
api/db/database-builder/factory/learning-content/build-framework.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,12 @@ | ||
import { databaseBuffer } from '../../database-buffer.js'; | ||
|
||
export function buildFramework({ id = 'frameworkPix', name = 'Pix' } = {}) { | ||
const values = { | ||
id, | ||
name, | ||
}; | ||
return databaseBuffer.pushInsertable({ | ||
tableName: 'learningcontent.frameworks', | ||
values, | ||
}); | ||
} |
33 changes: 33 additions & 0 deletions
33
api/db/database-builder/factory/learning-content/build-mission.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,33 @@ | ||
import { databaseBuffer } from '../../database-buffer.js'; | ||
|
||
export function buildMission({ | ||
id = 'missionIdA', | ||
status = 'status Mission A', | ||
name_i18n = { fr: 'name FR Mission A', en: 'name EN Mission A' }, | ||
content = { some: 'content' }, | ||
learningObjectives_i18n = { fr: 'learningObjectives FR Mission A', en: 'learningObjectives EN Mission A' }, | ||
validatedObjectives_i18n = { fr: 'validatedObjectives FR Mission A', en: 'validatedObjectives EN Mission A' }, | ||
introductionMediaType = 'introductionMediaType Mission A', | ||
introductionMediaAlt_i18n = { fr: 'introductionMediaAlt FR Mission A', en: 'introductionMediaAlt EN Mission A' }, | ||
documentationUrl = 'documentationUrl Mission A', | ||
cardImageUrl = 'cardImageUrl Mission A', | ||
competenceId = 'competenceIdA', | ||
} = {}) { | ||
const values = { | ||
id, | ||
status, | ||
name_i18n, | ||
content, | ||
learningObjectives_i18n, | ||
validatedObjectives_i18n, | ||
introductionMediaType, | ||
introductionMediaAlt_i18n, | ||
documentationUrl, | ||
cardImageUrl, | ||
competenceId, | ||
}; | ||
return databaseBuffer.pushInsertable({ | ||
tableName: 'learningcontent.missions', | ||
values, | ||
}); | ||
} |
33 changes: 33 additions & 0 deletions
33
api/db/database-builder/factory/learning-content/build-skill.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,33 @@ | ||
import { databaseBuffer } from '../../database-buffer.js'; | ||
|
||
export function buildSkill({ | ||
id = 'skillIdA', | ||
name = 'name Acquis A', | ||
status = 'status Acquis A', | ||
pixValue = 2.9, | ||
version = 5, | ||
level = 2, | ||
hintStatus = 'hintStatus Acquis A', | ||
competenceId = 'competenceIdA', | ||
tubeId = 'tubeIdA', | ||
tutorialIds = ['tutorialIdA'], | ||
learningMoreTutorialIds = [], | ||
} = {}) { | ||
const values = { | ||
id, | ||
name, | ||
status, | ||
pixValue, | ||
version, | ||
level, | ||
hintStatus, | ||
competenceId, | ||
tubeId, | ||
tutorialIds, | ||
learningMoreTutorialIds, | ||
}; | ||
return databaseBuffer.pushInsertable({ | ||
tableName: 'learningcontent.skills', | ||
values, | ||
}); | ||
} |
21 changes: 21 additions & 0 deletions
21
api/db/database-builder/factory/learning-content/build-thematic.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,21 @@ | ||
import { databaseBuffer } from '../../database-buffer.js'; | ||
|
||
export function buildThematic({ | ||
id = 'thematicIdA', | ||
name_i18n = { fr: 'name FR Thématique A', en: 'name EN Thématique A' }, | ||
index = 8, | ||
competenceId = 'competenceIdA', | ||
tubeIds = ['tubeIdA'], | ||
} = {}) { | ||
const values = { | ||
id, | ||
name_i18n, | ||
index, | ||
competenceId, | ||
tubeIds, | ||
}; | ||
return databaseBuffer.pushInsertable({ | ||
tableName: 'learningcontent.thematics', | ||
values, | ||
}); | ||
} |
33 changes: 33 additions & 0 deletions
33
api/db/database-builder/factory/learning-content/build-tube.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,33 @@ | ||
import { databaseBuffer } from '../../database-buffer.js'; | ||
|
||
export function buildTube({ | ||
id = 'tubeIdA', | ||
name = 'name Tube A', | ||
title = 'title Tube A', | ||
description = 'description Tube A', | ||
practicalTitle_i18n = { fr: 'practicalTitle FR Tube A', en: 'practicalTitle EN Tube A' }, | ||
practicalDescription_i18n = { fr: 'practicalDescription FR Tube A', en: 'practicalDescription EN Tube A' }, | ||
competenceId = 'competenceIdA', | ||
thematicId = 'thematicIdA', | ||
skillIds = ['skillIdA'], | ||
isMobileCompliant = true, | ||
isTabletCompliant = true, | ||
} = {}) { | ||
const values = { | ||
id, | ||
name, | ||
title, | ||
description, | ||
practicalTitle_i18n, | ||
practicalDescription_i18n, | ||
competenceId, | ||
thematicId, | ||
skillIds, | ||
isMobileCompliant, | ||
isTabletCompliant, | ||
}; | ||
return databaseBuffer.pushInsertable({ | ||
tableName: 'learningcontent.tubes', | ||
values, | ||
}); | ||
} |
25 changes: 25 additions & 0 deletions
25
api/db/database-builder/factory/learning-content/build-tutorial.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,25 @@ | ||
import { databaseBuffer } from '../../database-buffer.js'; | ||
|
||
export function buildTutorial({ | ||
id = 'tutorialIdA', | ||
duration = 'duration Tutoriel A', | ||
format = 'format Tutoriel A', | ||
title = 'title Tutoriel A', | ||
source = 'source Tutoriel A', | ||
link = 'link Tutoriel A', | ||
locale = 'fr', | ||
} = {}) { | ||
const values = { | ||
id, | ||
duration, | ||
format, | ||
title, | ||
source, | ||
link, | ||
locale, | ||
}; | ||
return databaseBuffer.pushInsertable({ | ||
tableName: 'learningcontent.tutorials', | ||
values, | ||
}); | ||
} |
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,30 @@ | ||
import nock from 'nock'; | ||
|
||
import { buildArea } from './build-area.js'; | ||
import { buildChallenge } from './build-challenge.js'; | ||
import { buildCompetence } from './build-competence.js'; | ||
import { buildCourse } from './build-course.js'; | ||
import { buildFramework } from './build-framework.js'; | ||
import { buildMission } from './build-mission.js'; | ||
import { buildSkill } from './build-skill.js'; | ||
import { buildThematic } from './build-thematic.js'; | ||
import { buildTube } from './build-tube.js'; | ||
import { buildTutorial } from './build-tutorial.js'; | ||
|
||
export function build(learningContent) { | ||
learningContent.frameworks?.forEach(buildFramework); | ||
learningContent.areas?.forEach(buildArea); | ||
learningContent.competences?.forEach(buildCompetence); | ||
learningContent.thematics?.forEach(buildThematic); | ||
learningContent.tubes?.forEach(buildTube); | ||
learningContent.skills?.forEach(buildSkill); | ||
learningContent.challenges?.forEach(buildChallenge); | ||
learningContent.courses?.forEach(buildCourse); | ||
learningContent.tutorials?.forEach(buildTutorial); | ||
learningContent.missions?.forEach(buildMission); | ||
|
||
return nock('https://lcms-test.pix.fr/api') | ||
.get('/releases/latest') | ||
.matchHeader('Authorization', 'Bearer test-api-key') | ||
.reply(200, { content: learningContent }); | ||
} |
Oops, something went wrong.