add content, add swagger
This commit is contained in:
@@ -1,16 +1,31 @@
|
||||
import type { Core } from '@strapi/strapi';
|
||||
import type { Core } from "@strapi/strapi";
|
||||
|
||||
const config: Core.Config.Middlewares = [
|
||||
'strapi::logger',
|
||||
'strapi::errors',
|
||||
'strapi::security',
|
||||
'strapi::cors',
|
||||
'strapi::poweredBy',
|
||||
'strapi::query',
|
||||
'strapi::body',
|
||||
'strapi::session',
|
||||
'strapi::favicon',
|
||||
'strapi::public',
|
||||
"strapi::logger",
|
||||
"strapi::errors",
|
||||
{
|
||||
name: "strapi::security",
|
||||
config: {
|
||||
contentSecurityPolicy: {
|
||||
useDefaults: true,
|
||||
directives: {
|
||||
"script-src": ["'self'", "'unsafe-inline'", "https://unpkg.com"],
|
||||
"style-src": ["'self'", "'unsafe-inline'", "https://unpkg.com"],
|
||||
"connect-src": ["'self'", "https:"],
|
||||
"img-src": ["'self'", "data:", "blob:", "https:"],
|
||||
"media-src": ["'self'", "data:", "blob:"],
|
||||
upgradeInsecureRequests: null,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"strapi::cors",
|
||||
"strapi::poweredBy",
|
||||
"strapi::query",
|
||||
"strapi::body",
|
||||
"strapi::session",
|
||||
"strapi::favicon",
|
||||
"strapi::public",
|
||||
];
|
||||
|
||||
export default config;
|
||||
|
||||
26
public/openapi.html
Normal file
26
public/openapi.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>API Documentation</title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
href="https://unpkg.com/swagger-ui-dist@5.0.0/swagger-ui.css"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="swagger-ui"></div>
|
||||
<script src="https://unpkg.com/swagger-ui-dist@5.0.0/swagger-ui-bundle.js"></script>
|
||||
<script src="https://unpkg.com/swagger-ui-dist@5.0.0/swagger-ui-standalone-preset.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
SwaggerUIBundle({
|
||||
url: "./swagger-spec.json",
|
||||
dom_id: "#swagger-ui",
|
||||
presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],
|
||||
layout: "StandaloneLayout",
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
10437
public/swagger-spec.json
Normal file
10437
public/swagger-spec.json
Normal file
File diff suppressed because it is too large
Load Diff
47
src/api/category/content-types/category/schema.json
Normal file
47
src/api/category/content-types/category/schema.json
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"kind": "collectionType",
|
||||
"collectionName": "categories",
|
||||
"info": {
|
||||
"singularName": "category",
|
||||
"pluralName": "categories",
|
||||
"displayName": "Category"
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": true
|
||||
},
|
||||
"pluginOptions": {},
|
||||
"attributes": {
|
||||
"slug": {
|
||||
"type": "uid",
|
||||
"required": true
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"comment": {
|
||||
"type": "string"
|
||||
},
|
||||
"group": {
|
||||
"type": "enumeration",
|
||||
"required": true,
|
||||
"enum": [
|
||||
"service",
|
||||
"solution"
|
||||
]
|
||||
},
|
||||
"sortOrder": {
|
||||
"type": "integer",
|
||||
"required": true,
|
||||
"default": 0
|
||||
},
|
||||
"vendors": {
|
||||
"type": "relation",
|
||||
"relation": "manyToMany",
|
||||
"target": "api::vendor.vendor",
|
||||
"inversedBy": "categories"
|
||||
}
|
||||
}
|
||||
}
|
||||
7
src/api/category/controllers/category.ts
Normal file
7
src/api/category/controllers/category.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* category controller
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreController('api::category.category');
|
||||
7
src/api/category/routes/category.ts
Normal file
7
src/api/category/routes/category.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* category router
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreRouter('api::category.category');
|
||||
7
src/api/category/services/category.ts
Normal file
7
src/api/category/services/category.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* category service
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreService('api::category.category');
|
||||
21
src/api/home-page/content-types/home-page/schema.json
Normal file
21
src/api/home-page/content-types/home-page/schema.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"kind": "singleType",
|
||||
"collectionName": "home_pages",
|
||||
"info": {
|
||||
"singularName": "home-page",
|
||||
"pluralName": "home-pages",
|
||||
"displayName": "Home Page"
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": true
|
||||
},
|
||||
"pluginOptions": {},
|
||||
"attributes": {
|
||||
"sections": {
|
||||
"type": "dynamiczone",
|
||||
"components": [
|
||||
"sections.home-hero"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
7
src/api/home-page/controllers/home-page.ts
Normal file
7
src/api/home-page/controllers/home-page.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* home-page controller
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreController('api::home-page.home-page');
|
||||
7
src/api/home-page/routes/home-page.ts
Normal file
7
src/api/home-page/routes/home-page.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* home-page router
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreRouter('api::home-page.home-page');
|
||||
7
src/api/home-page/services/home-page.ts
Normal file
7
src/api/home-page/services/home-page.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* home-page service
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreService('api::home-page.home-page');
|
||||
22
src/api/site-config/content-types/site-config/schema.json
Normal file
22
src/api/site-config/content-types/site-config/schema.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"kind": "singleType",
|
||||
"collectionName": "site_configs",
|
||||
"info": {
|
||||
"singularName": "site-config",
|
||||
"pluralName": "site-configs",
|
||||
"displayName": "Site config"
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": true
|
||||
},
|
||||
"pluginOptions": {},
|
||||
"attributes": {
|
||||
"title": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"description": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
7
src/api/site-config/controllers/site-config.ts
Normal file
7
src/api/site-config/controllers/site-config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* site-config controller
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreController('api::site-config.site-config');
|
||||
7
src/api/site-config/routes/site-config.ts
Normal file
7
src/api/site-config/routes/site-config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* site-config router
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreRouter('api::site-config.site-config');
|
||||
7
src/api/site-config/services/site-config.ts
Normal file
7
src/api/site-config/services/site-config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* site-config service
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreService('api::site-config.site-config');
|
||||
36
src/api/vendor/content-types/vendor/schema.json
vendored
Normal file
36
src/api/vendor/content-types/vendor/schema.json
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"kind": "collectionType",
|
||||
"collectionName": "vendors",
|
||||
"info": {
|
||||
"singularName": "vendor",
|
||||
"pluralName": "vendors",
|
||||
"displayName": "Vendor"
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": true
|
||||
},
|
||||
"pluginOptions": {},
|
||||
"attributes": {
|
||||
"slug": {
|
||||
"type": "uid",
|
||||
"required": true
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"products": {
|
||||
"type": "component",
|
||||
"component": "shared.product",
|
||||
"repeatable": true
|
||||
},
|
||||
"categories": {
|
||||
"type": "relation",
|
||||
"relation": "manyToMany",
|
||||
"target": "api::category.category",
|
||||
"mappedBy": "vendors"
|
||||
}
|
||||
}
|
||||
}
|
||||
7
src/api/vendor/controllers/vendor.ts
vendored
Normal file
7
src/api/vendor/controllers/vendor.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* vendor controller
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreController('api::vendor.vendor');
|
||||
7
src/api/vendor/routes/vendor.ts
vendored
Normal file
7
src/api/vendor/routes/vendor.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* vendor router
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreRouter('api::vendor.vendor');
|
||||
7
src/api/vendor/services/vendor.ts
vendored
Normal file
7
src/api/vendor/services/vendor.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* vendor service
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreService('api::vendor.vendor');
|
||||
24
src/components/sections/home-hero.json
Normal file
24
src/components/sections/home-hero.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"collectionName": "components_sections_home_heroes",
|
||||
"info": {
|
||||
"displayName": "HomeHero"
|
||||
},
|
||||
"options": {},
|
||||
"attributes": {
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"badge": {
|
||||
"type": "string"
|
||||
},
|
||||
"stats": {
|
||||
"type": "component",
|
||||
"component": "shared.attribute",
|
||||
"repeatable": true
|
||||
}
|
||||
},
|
||||
"config": {}
|
||||
}
|
||||
18
src/components/shared/attribute.json
Normal file
18
src/components/shared/attribute.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"collectionName": "components_shared_attributes",
|
||||
"info": {
|
||||
"displayName": "Attribute"
|
||||
},
|
||||
"options": {},
|
||||
"attributes": {
|
||||
"key": {
|
||||
"type": "string",
|
||||
"required": false
|
||||
},
|
||||
"value": {
|
||||
"type": "string",
|
||||
"required": false
|
||||
}
|
||||
},
|
||||
"config": {}
|
||||
}
|
||||
14
src/components/shared/product.json
Normal file
14
src/components/shared/product.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"collectionName": "components_shared_products",
|
||||
"info": {
|
||||
"displayName": "Product"
|
||||
},
|
||||
"options": {},
|
||||
"attributes": {
|
||||
"title": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"config": {}
|
||||
}
|
||||
45
types/generated/components.d.ts
vendored
Normal file
45
types/generated/components.d.ts
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import type { Schema, Struct } from '@strapi/strapi';
|
||||
|
||||
export interface SectionsHomeHero extends Struct.ComponentSchema {
|
||||
collectionName: 'components_sections_home_heroes';
|
||||
info: {
|
||||
displayName: 'HomeHero';
|
||||
};
|
||||
attributes: {
|
||||
badge: Schema.Attribute.String;
|
||||
description: Schema.Attribute.Text;
|
||||
stats: Schema.Attribute.Component<'shared.attribute', true>;
|
||||
title: Schema.Attribute.String;
|
||||
};
|
||||
}
|
||||
|
||||
export interface SharedAttribute extends Struct.ComponentSchema {
|
||||
collectionName: 'components_shared_attributes';
|
||||
info: {
|
||||
displayName: 'Attribute';
|
||||
};
|
||||
attributes: {
|
||||
key: Schema.Attribute.String;
|
||||
value: Schema.Attribute.String;
|
||||
};
|
||||
}
|
||||
|
||||
export interface SharedProduct extends Struct.ComponentSchema {
|
||||
collectionName: 'components_shared_products';
|
||||
info: {
|
||||
displayName: 'Product';
|
||||
};
|
||||
attributes: {
|
||||
title: Schema.Attribute.String & Schema.Attribute.Required;
|
||||
};
|
||||
}
|
||||
|
||||
declare module '@strapi/strapi' {
|
||||
export module Public {
|
||||
export interface ComponentSchemas {
|
||||
'sections.home-hero': SectionsHomeHero;
|
||||
'shared.attribute': SharedAttribute;
|
||||
'shared.product': SharedProduct;
|
||||
}
|
||||
}
|
||||
}
|
||||
1089
types/generated/contentTypes.d.ts
vendored
Normal file
1089
types/generated/contentTypes.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user