Skip to content
Snippets Groups Projects
Commit cca9031a authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

fix: db init script, bad collection name for structureType

parent a54d5de7
No related branches found
No related tags found
2 merge requests!97release V1.10.0,!96release V1.10.0
......@@ -2,7 +2,7 @@
const mongoose = require('mongoose');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const userData = require('./data/users');
const structuresTypesData = require('./data/structuresType');
const structuresTypeData = require('./data/structuresType');
const categoriesOthersData = require('./data/categoriesOthers');
const categoriesAccompanementsData = require('./data/categoriesAccompanements');
const categoriesFormationData = require('./data/categoriesFormation');
......@@ -57,10 +57,13 @@ var usersSchema = mongoose.Schema({
password: String,
phone: String,
});
var structuresTypeSchema = mongoose.Schema({
name: String,
values: [],
});
var structuresTypeSchema = mongoose.Schema(
{
name: String,
values: [],
},
{ collection: 'structuretype' }
);
var categoriesOthersSchema = mongoose.Schema({
name: String,
id: String,
......@@ -144,9 +147,9 @@ mongoose.connection.dropCollection('users', async (err) => {
});
/* Create structures ref */
mongoose.connection.dropCollection('structuretypes', async (err) => {
mongoose.connection.dropCollection('structuretype', async (err) => {
await handleError('structureType', err);
structuresType.create(structuresTypesData.data, (error) => {
structuresType.create(structuresTypeData.data, (error) => {
if (error) return console.error(error);
});
});
......@@ -166,7 +169,7 @@ mongoose.connection.dropCollection('categoriesaccompagnements', async (err) => {
});
mongoose.connection.dropCollection('categoriesformations', async (err) => {
await handleError('categoriesFormation', err);
await handleError('categoriesFormations', err);
categoriesFormation.create(categoriesFormationData.data, (error) => {
if (error) return console.error(error);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment