Commit a8d2834b by jay

updated

1 parent 5a6ed661
{
"kind": "singleType",
"collectionName": "current_histories",
"info": {
"singularName": "current-history",
"pluralName": "current-histories",
"displayName": "Current history",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"infoText": {
"type": "string"
},
"buttonText1": {
"type": "string"
},
"buttonText2": {
"type": "string"
},
"question1": {
"displayName": "Question 1",
"type": "component",
"repeatable": false,
"component": "question1.question-1"
},
"question2": {
"displayName": "question2",
"type": "component",
"repeatable": false,
"component": "question2.question2"
},
"question3": {
"displayName": "question3",
"type": "component",
"repeatable": false,
"component": "question3.question3"
}
}
}
'use strict';
/**
* current-history controller
*/
const { createCoreController } = require('@strapi/strapi').factories;
module.exports = createCoreController('api::current-history.current-history');
'use strict';
/**
* game router
* current-history router
*/
const { createCoreRouter } = require('@strapi/strapi').factories;
module.exports = createCoreRouter('api::game.game');
module.exports = createCoreRouter('api::current-history.current-history');
'use strict';
/**
* current-history service
*/
const { createCoreService } = require('@strapi/strapi').factories;
module.exports = createCoreService('api::current-history.current-history');
{
"kind": "collectionType",
"collectionName": "games",
"kind": "singleType",
"collectionName": "family_histories",
"info": {
"singularName": "game",
"pluralName": "games",
"displayName": "Games"
"singularName": "family-history",
"pluralName": "family-histories",
"displayName": "Family history",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"firstReleaseDate": {
"title": {
"type": "string"
},
"name": {
"type": "string"
},
"rating": {
"type": "string"
},
"summary": {
"type": "text"
}
}
}
'use strict';
/**
* family-history controller
*/
const { createCoreController } = require('@strapi/strapi').factories;
module.exports = createCoreController('api::family-history.family-history');
'use strict';
/**
* family-history router
*/
const { createCoreRouter } = require('@strapi/strapi').factories;
module.exports = createCoreRouter('api::family-history.family-history');
'use strict';
/**
* family-history service
*/
const { createCoreService } = require('@strapi/strapi').factories;
module.exports = createCoreService('api::family-history.family-history');
"use strict";
/**
* game controller
*/
const { createCoreController } = require("@strapi/strapi").factories;
module.exports = createCoreController("api::game.game", () => ({
async importSeedData(ctx) {
await strapi.service("api::game.game").importSeedDataFromApi();
ctx.send({ ok: true });
},
}));
const routes = {
routes: [
{
method: "POST",
path: "/games/import-seed-data",
handler: "api::game.game.importSeedData",
config: {
// some configuration...
}
},
]
};
module.exports = routes;
\ No newline at end of file
"use strict";
const axios = require("axios");
const { factories } = require("@strapi/strapi");
/**
* game service
*/
const { createCoreService } = require("@strapi/strapi").factories;
module.exports = factories.createCoreService(
"api::game.game",
({ strapi: Strapi }) => ({
async importSeedDataFromApi() {
const seedData = await axios.get(
"https://public.connectnow.org.uk/applicant-test/"
);
// console.log("seedData", seedData.data[0]);
let seedDataFinal = seedData.data;
const date = new Date()
const deletedCnt = await strapi.db.query("api::game.game").deleteMany({ where: {} });
for (let i = 0; i < seedDataFinal.length; i++) {
const item = seedDataFinal[i];
// console.log("seedData", item);
// console.log(`Attempting to create country: `, country);
await strapi.entityService.create("api::game.game", {
data: {
firstReleaseDate: `${item.first_release_date}`,
name: item.name,
rating: `${item.rating}`,
summary: item.summary,
publishedAt: date
},
});
}
},
})
);
{
"kind": "singleType",
"collectionName": "triggers",
"info": {
"singularName": "trigger",
"pluralName": "triggers",
"displayName": "Triggers",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"title": {
"type": "string"
}
}
}
'use strict';
/**
* trigger controller
*/
const { createCoreController } = require('@strapi/strapi').factories;
module.exports = createCoreController('api::trigger.trigger');
'use strict';
/**
* trigger router
*/
const { createCoreRouter } = require('@strapi/strapi').factories;
module.exports = createCoreRouter('api::trigger.trigger');
'use strict';
/**
* trigger service
*/
const { createCoreService } = require('@strapi/strapi').factories;
module.exports = createCoreService('api::trigger.trigger');
{
"collectionName": "components_options_options",
"info": {
"displayName": "options"
},
"options": {},
"attributes": {
"text": {
"type": "string"
}
}
}
{
"collectionName": "components_options2_options2s",
"info": {
"displayName": "options2"
},
"options": {},
"attributes": {
"text": {
"type": "string"
}
}
}
{
"collectionName": "components_options3_options3s",
"info": {
"displayName": "options3"
},
"options": {},
"attributes": {
"text": {
"type": "string"
}
}
}
{
"collectionName": "components_question1_question_1s",
"info": {
"displayName": "Question 1"
},
"options": {},
"attributes": {
"question": {
"type": "string"
},
"options": {
"displayName": "options",
"type": "component",
"repeatable": true,
"component": "options.options"
}
}
}
{
"collectionName": "components_question2_question2s",
"info": {
"displayName": "question2"
},
"options": {},
"attributes": {
"question": {
"type": "string"
},
"options": {
"displayName": "options2",
"type": "component",
"repeatable": true,
"component": "options2.options2"
}
}
}
{
"collectionName": "components_question3_question3s",
"info": {
"displayName": "question3"
},
"options": {},
"attributes": {
"question": {
"type": "string"
},
"options3": {
"displayName": "options3",
"type": "component",
"repeatable": true,
"component": "options3.options3"
}
}
}
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!