Файловый менеджер - Редактировать - /home/freeclou/app.optimyar.com/front-web/build/assets/fonts/course.tar
Назад
config/routes.json 0000644 00000001617 15105575110 0010232 0 ustar 00 { "routes": [ { "method": "GET", "path": "/courses", "handler": "course.find", "config": { "policies": [] } }, { "method": "GET", "path": "/courses/count", "handler": "course.count", "config": { "policies": [] } }, { "method": "GET", "path": "/courses/:id", "handler": "course.findOne", "config": { "policies": [] } }, { "method": "POST", "path": "/courses", "handler": "course.create", "config": { "policies": [] } }, { "method": "PUT", "path": "/courses/:id", "handler": "course.update", "config": { "policies": [] } }, { "method": "DELETE", "path": "/courses/:id", "handler": "course.delete", "config": { "policies": [] } } ] } controllers/course.js 0000644 00000001675 15105575110 0010761 0 ustar 00 'use strict'; const {sanitizeEntity} = require('strapi-utils'); /** * Read the documentation (https://strapi.io/documentation/v3.x/concepts/controllers.html#core-controllers) * to customize this controller */ module.exports = { async create(ctx) { const toSave = ctx.request.body; let isValid = await strapi.services.course.isValid(toSave); if (isValid !== true) {//is string return ctx.badRequest(null, isValid); } const levelIds = await toSave.course_levels.reduce(async (memo, l) => { const results = await memo; const ids = await strapi.services.helpers.saveListEntity("session", l.sessions); l.sessions = ids; const level = await strapi.services["course-level"].create(l); return [...results, level._id]; }, []); toSave.course_levels = levelIds; let entity = await strapi.services.course.create(toSave); return sanitizeEntity(entity, {model: strapi.models.course}); } }; documentation/1.0.0/course.json 0000644 00000037704 15105575110 0012257 0 ustar 00 { "paths": { "/courses": { "get": { "deprecated": false, "description": "", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Course" } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "Course" ], "parameters": [ { "name": "_limit", "in": "query", "required": false, "description": "Maximum number of results possible", "schema": { "type": "integer" }, "deprecated": false }, { "name": "_sort", "in": "query", "required": false, "description": "Sort according to a specific field.", "schema": { "type": "string" }, "deprecated": false }, { "name": "_start", "in": "query", "required": false, "description": "Skip a specific number of entries (especially useful for pagination)", "schema": { "type": "integer" }, "deprecated": false }, { "name": "=", "in": "query", "required": false, "description": "Get entries that matches exactly your input", "schema": { "type": "string" }, "deprecated": false }, { "name": "_ne", "in": "query", "required": false, "description": "Get records that are not equals to something", "schema": { "type": "string" }, "deprecated": false }, { "name": "_lt", "in": "query", "required": false, "description": "Get record that are lower than a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_lte", "in": "query", "required": false, "description": "Get records that are lower than or equal to a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_gt", "in": "query", "required": false, "description": "Get records that are greater than a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_gte", "in": "query", "required": false, "description": "Get records that are greater than or equal a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_contains", "in": "query", "required": false, "description": "Get records that contains a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_containss", "in": "query", "required": false, "description": "Get records that contains (case sensitive) a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_in", "in": "query", "required": false, "description": "Get records that matches any value in the array of values", "schema": { "type": "array", "items": { "type": "string" } }, "deprecated": false }, { "name": "_nin", "in": "query", "required": false, "description": "Get records that doesn't match any value in the array of values", "schema": { "type": "array", "items": { "type": "string" } }, "deprecated": false } ] }, "post": { "deprecated": false, "description": "Create a new record", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Course" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "Course" ], "requestBody": { "description": "", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewCourse" } } } } } }, "/courses/count": { "get": { "deprecated": false, "description": "", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "count": { "type": "integer" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "Course" ], "parameters": [] } }, "/courses/{id}": { "get": { "deprecated": false, "description": "", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Course" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "Course" ], "parameters": [ { "name": "id", "in": "path", "description": "", "deprecated": false, "required": true, "schema": { "type": "string" } } ] }, "put": { "deprecated": false, "description": "Update a record", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Course" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "Course" ], "requestBody": { "description": "", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewCourse" } } } }, "parameters": [ { "name": "id", "in": "path", "description": "", "deprecated": false, "required": true, "schema": { "type": "string" } } ] }, "delete": { "deprecated": false, "description": "Delete a record", "responses": { "200": { "description": "deletes a single record based on the ID supplied", "content": { "application/json": { "schema": { "type": "integer", "format": "int64" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "Course" ], "parameters": [ { "name": "id", "in": "path", "description": "", "deprecated": false, "required": true, "schema": { "type": "string" } } ] } } }, "components": { "schemas": { "Course": { "required": [ "id", "title" ], "properties": { "id": { "type": "string" }, "title": { "type": "string", "minLength": 3 }, "course_levels": { "type": "array", "items": { "required": [ "id", "title", "price", "fromDate", "toDate" ], "properties": { "id": { "type": "string" }, "title": { "type": "string" }, "coverImage": { "type": "string" }, "price": { "type": "integer" }, "desc": { "type": "string" }, "enableDiscount": { "type": "boolean" }, "sessions": { "type": "array", "items": { "type": "string" } }, "fromDate": { "type": "string" }, "toDate": { "type": "string" }, "status": { "type": "string", "enum": [ "register", "progress", "finish", "preRegister", "registerFinish" ] }, "location": { "type": "string" }, "infoLink": { "type": "string" }, "isLive": { "type": "boolean" }, "isGeneral": { "type": "boolean" }, "course": { "type": "string" }, "teacher": { "type": "string" }, "desc2": { "type": "string" }, "created_by": { "type": "string" }, "updated_by": { "type": "string" } } } } } }, "NewCourse": { "required": [ "title" ], "properties": { "title": { "type": "string", "minLength": 3 }, "course_levels": { "type": "array", "items": { "type": "string" } }, "created_by": { "type": "string" }, "updated_by": { "type": "string" } } } } }, "tags": [ { "name": "Course" } ] } models/course.js 0000644 00000000256 15105575110 0007670 0 ustar 00 'use strict'; /** * Read the documentation (https://strapi.io/documentation/v3.x/concepts/models.html#lifecycle-hooks) * to customize this model */ module.exports = {}; models/course.settings.json 0000644 00000000616 15105575110 0012064 0 ustar 00 { "kind": "collectionType", "collectionName": "courses", "info": { "name": "Course", "description": "" }, "options": { "increments": true, "timestamps": true, "draftAndPublish": false }, "attributes": { "title": { "type": "string", "required": true, "minLength": 3 }, "course_levels": { "collection": "course-level" } } } services/course.js 0000644 00000001021 15105575110 0010217 0 ustar 00 'use strict'; /** * Read the documentation (https://strapi.io/documentation/v3.x/concepts/services.html#core-services) * to customize this service */ module.exports = { async isValid(data) { // let result = data.title && data.fromDate && data.toDate && data.price && data.coverImage; // if (!result){ // return "errors.fillRequiredFields"; // } let result = data.course_levels && data.course_levels.length > 0; if (!result) { return "course.errors.setLevels"; } return true; } };
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка