add content, add swagger

This commit is contained in:
Zotov Ivan Yuryevich
2026-04-05 15:06:27 +03:00
parent 981a01e8ef
commit 2ed71cfa30
24 changed files with 11889 additions and 11 deletions

View File

@@ -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
View 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

File diff suppressed because it is too large Load Diff

View 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"
}
}
}

View File

@@ -0,0 +1,7 @@
/**
* category controller
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreController('api::category.category');

View File

@@ -0,0 +1,7 @@
/**
* category router
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::category.category');

View File

@@ -0,0 +1,7 @@
/**
* category service
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::category.category');

View 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"
]
}
}
}

View File

@@ -0,0 +1,7 @@
/**
* home-page controller
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreController('api::home-page.home-page');

View File

@@ -0,0 +1,7 @@
/**
* home-page router
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::home-page.home-page');

View File

@@ -0,0 +1,7 @@
/**
* home-page service
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::home-page.home-page');

View 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"
}
}
}

View File

@@ -0,0 +1,7 @@
/**
* site-config controller
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreController('api::site-config.site-config');

View File

@@ -0,0 +1,7 @@
/**
* site-config router
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::site-config.site-config');

View File

@@ -0,0 +1,7 @@
/**
* site-config service
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::site-config.site-config');

View 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
View 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
View 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
View File

@@ -0,0 +1,7 @@
/**
* vendor service
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::vendor.vendor');

View 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": {}
}

View 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": {}
}

View 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
View 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

File diff suppressed because it is too large Load Diff