Initial Strapi plugin project
16
.editorconfig
Normal file
@@ -0,0 +1,16 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[{package.json,*.yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
1
.eslintignore
Normal file
@@ -0,0 +1 @@
|
||||
dist
|
||||
138
.gitignore
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
############################
|
||||
# OS X
|
||||
############################
|
||||
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
Icon
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
._*
|
||||
|
||||
|
||||
############################
|
||||
# Linux
|
||||
############################
|
||||
|
||||
*~
|
||||
|
||||
|
||||
############################
|
||||
# Windows
|
||||
############################
|
||||
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
$RECYCLE.BIN/
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
|
||||
############################
|
||||
# Packages
|
||||
############################
|
||||
|
||||
*.7z
|
||||
*.csv
|
||||
*.dat
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.seed
|
||||
*.so
|
||||
*.swo
|
||||
*.swp
|
||||
*.swn
|
||||
*.swm
|
||||
*.out
|
||||
*.pid
|
||||
|
||||
|
||||
############################
|
||||
# Logs and databases
|
||||
############################
|
||||
|
||||
.tmp
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
*.sqlite3
|
||||
|
||||
|
||||
############################
|
||||
# Misc.
|
||||
############################
|
||||
|
||||
*#
|
||||
ssl
|
||||
.idea
|
||||
nbproject
|
||||
.tsbuildinfo
|
||||
.eslintcache
|
||||
.env
|
||||
|
||||
|
||||
############################
|
||||
# Strapi
|
||||
############################
|
||||
|
||||
public/uploads/*
|
||||
!public/uploads/.gitkeep
|
||||
|
||||
|
||||
############################
|
||||
# Build
|
||||
############################
|
||||
|
||||
dist
|
||||
build
|
||||
|
||||
|
||||
############################
|
||||
# Node.js
|
||||
############################
|
||||
|
||||
lib-cov
|
||||
lcov.info
|
||||
pids
|
||||
logs
|
||||
results
|
||||
node_modules
|
||||
.node_history
|
||||
|
||||
|
||||
############################
|
||||
# Package managers
|
||||
############################
|
||||
|
||||
.yarn/*
|
||||
!.yarn/cache
|
||||
!.yarn/unplugged
|
||||
!.yarn/patches
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
.pnp.*
|
||||
yarn-error.log
|
||||
|
||||
|
||||
############################
|
||||
# Tests
|
||||
############################
|
||||
|
||||
coverage
|
||||
2
.prettierignore
Normal file
@@ -0,0 +1,2 @@
|
||||
dist
|
||||
coverage
|
||||
7
.prettierrc
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"endOfLine": "lf",
|
||||
"tabWidth": 2,
|
||||
"printWidth": 100,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "es5"
|
||||
}
|
||||
2
admin/custom.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare module '@strapi/design-system/*';
|
||||
declare module '@strapi/design-system';
|
||||
19
admin/src/components/Initializer.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
|
||||
import { PLUGIN_ID } from '../pluginId';
|
||||
|
||||
type InitializerProps = {
|
||||
setPlugin: (id: string) => void;
|
||||
};
|
||||
|
||||
const Initializer = ({ setPlugin }: InitializerProps) => {
|
||||
const ref = useRef(setPlugin);
|
||||
|
||||
useEffect(() => {
|
||||
ref.current(PLUGIN_ID);
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export { Initializer };
|
||||
5
admin/src/components/PluginIcon.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { PuzzlePiece } from '@strapi/icons';
|
||||
|
||||
const PluginIcon = () => <PuzzlePiece />;
|
||||
|
||||
export { PluginIcon };
|
||||
43
admin/src/index.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import { getTranslation } from './utils/getTranslation';
|
||||
import { PLUGIN_ID } from './pluginId';
|
||||
import { Initializer } from './components/Initializer';
|
||||
import { PluginIcon } from './components/PluginIcon';
|
||||
|
||||
export default {
|
||||
register(app: any) {
|
||||
app.addMenuLink({
|
||||
to: `plugins/${PLUGIN_ID}`,
|
||||
icon: PluginIcon,
|
||||
intlLabel: {
|
||||
id: `${PLUGIN_ID}.plugin.name`,
|
||||
defaultMessage: PLUGIN_ID,
|
||||
},
|
||||
Component: async () => {
|
||||
const { App } = await import('./pages/App');
|
||||
|
||||
return App;
|
||||
},
|
||||
});
|
||||
|
||||
app.registerPlugin({
|
||||
id: PLUGIN_ID,
|
||||
initializer: Initializer,
|
||||
isReady: false,
|
||||
name: PLUGIN_ID,
|
||||
});
|
||||
},
|
||||
|
||||
async registerTrads({ locales }: { locales: string[] }) {
|
||||
return Promise.all(
|
||||
locales.map(async (locale) => {
|
||||
try {
|
||||
const { default: data } = await import(`./translations/${locale}.json`);
|
||||
|
||||
return { data, locale };
|
||||
} catch {
|
||||
return { data: {}, locale };
|
||||
}
|
||||
})
|
||||
);
|
||||
},
|
||||
};
|
||||
15
admin/src/pages/App.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Page } from '@strapi/strapi/admin';
|
||||
import { Routes, Route } from 'react-router-dom';
|
||||
|
||||
import { HomePage } from './HomePage';
|
||||
|
||||
const App = () => {
|
||||
return (
|
||||
<Routes>
|
||||
<Route index element={<HomePage />} />
|
||||
<Route path="*" element={<Page.Error />} />
|
||||
</Routes>
|
||||
);
|
||||
};
|
||||
|
||||
export { App };
|
||||
16
admin/src/pages/HomePage.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Main } from '@strapi/design-system';
|
||||
import { useIntl } from 'react-intl';
|
||||
|
||||
import { getTranslation } from '../utils/getTranslation';
|
||||
|
||||
const HomePage = () => {
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
return (
|
||||
<Main>
|
||||
<h1>Welcome to {formatMessage({ id: getTranslation('plugin.name') })}</h1>
|
||||
</Main>
|
||||
);
|
||||
};
|
||||
|
||||
export { HomePage };
|
||||
1
admin/src/pluginId.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const PLUGIN_ID = 'checkbox-list';
|
||||
1
admin/src/translations/en.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
5
admin/src/utils/getTranslation.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { PLUGIN_ID } from '../pluginId';
|
||||
|
||||
const getTranslation = (id: string) => `${PLUGIN_ID}.${id}`;
|
||||
|
||||
export { getTranslation };
|
||||
10
admin/tsconfig.build.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "./tsconfig",
|
||||
"include": ["./src", "./custom.d.ts"],
|
||||
"exclude": ["**/*.test.ts", "**/*.test.tsx"],
|
||||
"compilerOptions": {
|
||||
"rootDir": "../",
|
||||
"baseUrl": ".",
|
||||
"outDir": "./dist"
|
||||
}
|
||||
}
|
||||
8
admin/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "@strapi/typescript-utils/tsconfigs/admin",
|
||||
"include": ["./src", "./custom.d.ts"],
|
||||
"compilerOptions": {
|
||||
"rootDir": "../",
|
||||
"baseUrl": "."
|
||||
}
|
||||
}
|
||||
24243
package-lock.json
generated
Normal file
77
package.json
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"version": "0.0.0",
|
||||
"keywords": [],
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
"./strapi-admin": {
|
||||
"types": "./dist/admin/src/index.d.ts",
|
||||
"source": "./admin/src/index.ts",
|
||||
"import": "./dist/admin/index.mjs",
|
||||
"require": "./dist/admin/index.js",
|
||||
"default": "./dist/admin/index.js"
|
||||
},
|
||||
"./strapi-server": {
|
||||
"types": "./dist/server/src/index.d.ts",
|
||||
"source": "./server/src/index.ts",
|
||||
"import": "./dist/server/index.mjs",
|
||||
"require": "./dist/server/index.js",
|
||||
"default": "./dist/server/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "strapi-plugin build",
|
||||
"watch": "strapi-plugin watch",
|
||||
"watch:link": "strapi-plugin watch:link",
|
||||
"verify": "strapi-plugin verify",
|
||||
"test:ts:front": "run -T tsc -p admin/tsconfig.json",
|
||||
"test:ts:back": "run -T tsc -p server/tsconfig.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@strapi/design-system": "^2.0.0-rc.30",
|
||||
"@strapi/icons": "^2.0.0-rc.30",
|
||||
"react-intl": "^7.1.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@strapi/sdk-plugin": "^5.4.0",
|
||||
"@strapi/strapi": "^5.35.0",
|
||||
"@strapi/typescript-utils": "^5.35.0",
|
||||
"@types/react": "^19.2.12",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"prettier": "^3.8.1",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-router-dom": "^6.30.3",
|
||||
"styled-components": "^6.3.8",
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@strapi/sdk-plugin": "^5.4.0",
|
||||
"@strapi/strapi": "^5.35.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-router-dom": "^6.30.3",
|
||||
"styled-components": "^6.3.8"
|
||||
},
|
||||
"strapi": {
|
||||
"kind": "plugin",
|
||||
"name": "strapi-plugin-checkbox-list",
|
||||
"displayName": "",
|
||||
"description": ""
|
||||
},
|
||||
"name": "strapi-plugin-checkbox-list",
|
||||
"description": "",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@popov.link/valentineus/strapi-plugin-checkbox-list.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://popov.link/valentineus/strapi-plugin-checkbox-list/issues"
|
||||
},
|
||||
"homepage": "https://popov.link/valentineus/strapi-plugin-checkbox-list#readme",
|
||||
"author": "Valentin Popov <valentin@popov.link>"
|
||||
}
|
||||
8
playground/.env.example
Normal file
@@ -0,0 +1,8 @@
|
||||
HOST=0.0.0.0
|
||||
PORT=1337
|
||||
APP_KEYS="toBeModified1,toBeModified2"
|
||||
API_TOKEN_SALT=tobemodified
|
||||
ADMIN_JWT_SECRET=tobemodified
|
||||
TRANSFER_TOKEN_SALT=tobemodified
|
||||
JWT_SECRET=tobemodified
|
||||
ENCRYPTION_KEY=tobemodified
|
||||
133
playground/.gitignore
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
############################
|
||||
# OS X
|
||||
############################
|
||||
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
Icon
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
._*
|
||||
|
||||
|
||||
############################
|
||||
# Linux
|
||||
############################
|
||||
|
||||
*~
|
||||
|
||||
|
||||
############################
|
||||
# Windows
|
||||
############################
|
||||
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
$RECYCLE.BIN/
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
|
||||
############################
|
||||
# Packages
|
||||
############################
|
||||
|
||||
*.7z
|
||||
*.csv
|
||||
*.dat
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.seed
|
||||
*.so
|
||||
*.swo
|
||||
*.swp
|
||||
*.swn
|
||||
*.swm
|
||||
*.out
|
||||
*.pid
|
||||
|
||||
|
||||
############################
|
||||
# Logs and databases
|
||||
############################
|
||||
|
||||
.tmp
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
*.sqlite3
|
||||
|
||||
|
||||
############################
|
||||
# Misc.
|
||||
############################
|
||||
|
||||
*#
|
||||
ssl
|
||||
.idea
|
||||
nbproject
|
||||
public/uploads/*
|
||||
!public/uploads/.gitkeep
|
||||
.tsbuildinfo
|
||||
.eslintcache
|
||||
|
||||
############################
|
||||
# Node.js
|
||||
############################
|
||||
|
||||
lib-cov
|
||||
lcov.info
|
||||
pids
|
||||
logs
|
||||
results
|
||||
node_modules
|
||||
.node_history
|
||||
|
||||
############################
|
||||
# Package managers
|
||||
############################
|
||||
|
||||
.yalc/*
|
||||
.yarn/*
|
||||
!.yarn/cache
|
||||
!.yarn/unplugged
|
||||
!.yarn/patches
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
.pnp.*
|
||||
yalc.lock
|
||||
yarn-error.log
|
||||
|
||||
############################
|
||||
# Tests
|
||||
############################
|
||||
|
||||
coverage
|
||||
|
||||
############################
|
||||
# Strapi
|
||||
############################
|
||||
|
||||
.env
|
||||
license.txt
|
||||
exports
|
||||
.strapi
|
||||
dist
|
||||
build
|
||||
.strapi-updater.json
|
||||
.strapi-cloud.json
|
||||
61
playground/README.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# 🚀 Getting started with Strapi
|
||||
|
||||
Strapi comes with a full featured [Command Line Interface](https://docs.strapi.io/dev-docs/cli) (CLI) which lets you scaffold and manage your project in seconds.
|
||||
|
||||
### `develop`
|
||||
|
||||
Start your Strapi application with autoReload enabled. [Learn more](https://docs.strapi.io/dev-docs/cli#strapi-develop)
|
||||
|
||||
```
|
||||
npm run develop
|
||||
# or
|
||||
yarn develop
|
||||
```
|
||||
|
||||
### `start`
|
||||
|
||||
Start your Strapi application with autoReload disabled. [Learn more](https://docs.strapi.io/dev-docs/cli#strapi-start)
|
||||
|
||||
```
|
||||
npm run start
|
||||
# or
|
||||
yarn start
|
||||
```
|
||||
|
||||
### `build`
|
||||
|
||||
Build your admin panel. [Learn more](https://docs.strapi.io/dev-docs/cli#strapi-build)
|
||||
|
||||
```
|
||||
npm run build
|
||||
# or
|
||||
yarn build
|
||||
```
|
||||
|
||||
## ⚙️ Deployment
|
||||
|
||||
Strapi gives you many possible deployment options for your project including [Strapi Cloud](https://cloud.strapi.io). Browse the [deployment section of the documentation](https://docs.strapi.io/dev-docs/deployment) to find the best solution for your use case.
|
||||
|
||||
```
|
||||
yarn strapi deploy
|
||||
```
|
||||
|
||||
## 📚 Learn more
|
||||
|
||||
- [Resource center](https://strapi.io/resource-center) - Strapi resource center.
|
||||
- [Strapi documentation](https://docs.strapi.io) - Official Strapi documentation.
|
||||
- [Strapi tutorials](https://strapi.io/tutorials) - List of tutorials made by the core team and the community.
|
||||
- [Strapi blog](https://strapi.io/blog) - Official Strapi blog containing articles made by the Strapi team and the community.
|
||||
- [Changelog](https://strapi.io/changelog) - Find out about the Strapi product updates, new features and general improvements.
|
||||
|
||||
Feel free to check out the [Strapi GitHub repository](https://github.com/strapi/strapi). Your feedback and contributions are welcome!
|
||||
|
||||
## ✨ Community
|
||||
|
||||
- [Discord](https://discord.strapi.io) - Come chat with the Strapi community including the core team.
|
||||
- [Forum](https://forum.strapi.io/) - Place to discuss, ask questions and find answers, show your Strapi project and get feedback or just talk with other Community members.
|
||||
- [Awesome Strapi](https://github.com/strapi/awesome-strapi) - A curated list of awesome things related to Strapi.
|
||||
|
||||
---
|
||||
|
||||
<sub>🤫 Psst! [Strapi is hiring](https://strapi.io/careers).</sub>
|
||||
20
playground/config/admin.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
export default ({ env }) => ({
|
||||
auth: {
|
||||
secret: env('ADMIN_JWT_SECRET'),
|
||||
},
|
||||
apiToken: {
|
||||
salt: env('API_TOKEN_SALT'),
|
||||
},
|
||||
transfer: {
|
||||
token: {
|
||||
salt: env('TRANSFER_TOKEN_SALT'),
|
||||
},
|
||||
},
|
||||
secrets: {
|
||||
encryptionKey: env('ENCRYPTION_KEY'),
|
||||
},
|
||||
flags: {
|
||||
nps: env.bool('FLAG_NPS', true),
|
||||
promoteEE: env.bool('FLAG_PROMOTE_EE', true),
|
||||
},
|
||||
});
|
||||
7
playground/config/api.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export default {
|
||||
rest: {
|
||||
defaultLimit: 25,
|
||||
maxLimit: 100,
|
||||
withCount: true,
|
||||
},
|
||||
};
|
||||
60
playground/config/database.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import path from 'path';
|
||||
|
||||
export default ({ env }) => {
|
||||
const client = env('DATABASE_CLIENT', 'sqlite');
|
||||
|
||||
const connections = {
|
||||
mysql: {
|
||||
connection: {
|
||||
host: env('DATABASE_HOST', 'localhost'),
|
||||
port: env.int('DATABASE_PORT', 3306),
|
||||
database: env('DATABASE_NAME', 'strapi'),
|
||||
user: env('DATABASE_USERNAME', 'strapi'),
|
||||
password: env('DATABASE_PASSWORD', 'strapi'),
|
||||
ssl: env.bool('DATABASE_SSL', false) && {
|
||||
key: env('DATABASE_SSL_KEY', undefined),
|
||||
cert: env('DATABASE_SSL_CERT', undefined),
|
||||
ca: env('DATABASE_SSL_CA', undefined),
|
||||
capath: env('DATABASE_SSL_CAPATH', undefined),
|
||||
cipher: env('DATABASE_SSL_CIPHER', undefined),
|
||||
rejectUnauthorized: env.bool('DATABASE_SSL_REJECT_UNAUTHORIZED', true),
|
||||
},
|
||||
},
|
||||
pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
|
||||
},
|
||||
postgres: {
|
||||
connection: {
|
||||
connectionString: env('DATABASE_URL'),
|
||||
host: env('DATABASE_HOST', 'localhost'),
|
||||
port: env.int('DATABASE_PORT', 5432),
|
||||
database: env('DATABASE_NAME', 'strapi'),
|
||||
user: env('DATABASE_USERNAME', 'strapi'),
|
||||
password: env('DATABASE_PASSWORD', 'strapi'),
|
||||
ssl: env.bool('DATABASE_SSL', false) && {
|
||||
key: env('DATABASE_SSL_KEY', undefined),
|
||||
cert: env('DATABASE_SSL_CERT', undefined),
|
||||
ca: env('DATABASE_SSL_CA', undefined),
|
||||
capath: env('DATABASE_SSL_CAPATH', undefined),
|
||||
cipher: env('DATABASE_SSL_CIPHER', undefined),
|
||||
rejectUnauthorized: env.bool('DATABASE_SSL_REJECT_UNAUTHORIZED', true),
|
||||
},
|
||||
schema: env('DATABASE_SCHEMA', 'public'),
|
||||
},
|
||||
pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
|
||||
},
|
||||
sqlite: {
|
||||
connection: {
|
||||
filename: path.join(__dirname, '..', '..', env('DATABASE_FILENAME', '.tmp/data.db')),
|
||||
},
|
||||
useNullAsDefault: true,
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
connection: {
|
||||
client,
|
||||
...connections[client],
|
||||
acquireConnectionTimeout: env.int('DATABASE_CONNECTION_TIMEOUT', 60000),
|
||||
},
|
||||
};
|
||||
};
|
||||
12
playground/config/middlewares.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export default [
|
||||
'strapi::logger',
|
||||
'strapi::errors',
|
||||
'strapi::security',
|
||||
'strapi::cors',
|
||||
'strapi::poweredBy',
|
||||
'strapi::query',
|
||||
'strapi::body',
|
||||
'strapi::session',
|
||||
'strapi::favicon',
|
||||
'strapi::public',
|
||||
];
|
||||
1
playground/config/plugins.ts
Normal file
@@ -0,0 +1 @@
|
||||
export default () => ({});
|
||||
7
playground/config/server.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export default ({ env }) => ({
|
||||
host: env('HOST', '0.0.0.0'),
|
||||
port: env.int('PORT', 1337),
|
||||
app: {
|
||||
keys: env.array('APP_KEYS'),
|
||||
},
|
||||
});
|
||||
241
playground/data/data.json
Normal file
@@ -0,0 +1,241 @@
|
||||
{
|
||||
"global": {
|
||||
"siteName": "Strapi Blog",
|
||||
"defaultSeo": {
|
||||
"metaTitle": "Page",
|
||||
"metaDescription": "A blog made with Strapi",
|
||||
"shareImage": null
|
||||
},
|
||||
"siteDescription": "A Blog made with Strapi",
|
||||
"favicon": null
|
||||
},
|
||||
"about": {
|
||||
"title": "About the strapi blog",
|
||||
"blocks": [
|
||||
{
|
||||
"__component": "shared.quote",
|
||||
"title": "Thelonius Monk",
|
||||
"body": "You've got to dig it to dig it, you dig?"
|
||||
},
|
||||
{
|
||||
"__component": "shared.rich-text",
|
||||
"body": "## Dedit imago conspicuus cum capillis totidem inhibere\n\nLorem markdownum **rerum**, est limine: columbas: ab infelix hostem arbore nudis\ncrudelis. Videtur reliquit ambo ferrum dote sub amne fatis **illuc**, in magis,\nnec."
|
||||
},
|
||||
{
|
||||
"__component": "shared.media",
|
||||
"file": "coffee-art.jpg"
|
||||
}
|
||||
]
|
||||
},
|
||||
"categories": [
|
||||
{
|
||||
"name": "news",
|
||||
"slug": "news"
|
||||
},
|
||||
{
|
||||
"name": "tech",
|
||||
"slug": "tech"
|
||||
},
|
||||
{
|
||||
"name": "food",
|
||||
"slug": "food"
|
||||
},
|
||||
{
|
||||
"name": "nature",
|
||||
"slug": "nature"
|
||||
},
|
||||
{
|
||||
"name": "story",
|
||||
"slug": "story"
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "David Doe",
|
||||
"email": "daviddoe@strapi.io",
|
||||
"avatar": "daviddoe@strapi.io.jpg"
|
||||
},
|
||||
{
|
||||
"name": "Sarah Baker",
|
||||
"email": "sarahbaker@strapi.io",
|
||||
"avatar": "sarahbaker@strapi.io.jpg"
|
||||
}
|
||||
],
|
||||
"articles": [
|
||||
{
|
||||
"title": "The internet's Own boy",
|
||||
"slug": "the-internet-s-own-boy",
|
||||
"category": {
|
||||
"id": 5
|
||||
},
|
||||
"author": {
|
||||
"id": 1
|
||||
},
|
||||
"description": "Follow the story of Aaron Swartz, the boy who could change the world",
|
||||
"cover": null,
|
||||
"blocks": [
|
||||
{
|
||||
"__component": "shared.rich-text",
|
||||
"body": "## Probant \n\nse Lorem markdownum negat. Argo *saxa* videnda cornuaque hunc qui tanta spes teneas! Obliquis est dicenti est salutat ille tamen iuvenum nostrae dolore. - Colores nocituraque comitata eripiunt - Addit quodcunque solum cui et dextram illis - Nulli meus nec extemplo ille ferebat pressit Se blandita fulvae vox gravem Pittheus cesserunt sanguine herbis tu comitum tenuit. Sui in ruunt; Doridaque maculosae fuissem! Et loqui. \n\n## Abit sua\n\nse Lorem markdownum negat. Argo *saxa* videnda cornuaque hunc qui tanta spes teneas! Obliquis est dicenti est salutat ille tamen iuvenum nostrae dolore. - Colores nocituraque comitata eripiunt - Addit quodcunque solum cui et dextram illis - Nulli meus nec extemplo ille ferebat pressit Se blandita fulvae vox gravem Pittheus cesserunt sanguine herbis tu comitum tenuit. Sui in ruunt; Doridaque maculosae fuissem! Et loqui. "
|
||||
},
|
||||
{
|
||||
"__component": "shared.quote",
|
||||
"title": "Thelonius Monk",
|
||||
"body": "You've got to dig it to dig it, you dig?"
|
||||
},
|
||||
{
|
||||
"__component": "shared.media",
|
||||
"file": "coffee-art.jpg"
|
||||
},
|
||||
{
|
||||
"__component": "shared.rich-text",
|
||||
"body": "## Spatiantia astra \n\nFoeda, medio silva *errandum*: onus formam munere. Mutata bibulis est auxiliare arces etiamnunc verbis virgineo Priamidas illa Thescelus, nam fit locis lucis auras. Exitus hospes gratulor ut pondere [speslimite](http://www.curas.io/figuram); quid habent, Avernales faciente de. Pervenit Ino sonabile supplex cognoscenti vires, Bacchumque errat miserarum venandi dignabere dedisti. Discrimina iuncosaque virgaque tot sine superest [fissus](http://quos.org/sitet.aspx). Non color esset potest non sumit, sed vix arserat. Nisi immo silva tantum pectusque quos pennis quisquam artus!"
|
||||
},
|
||||
{
|
||||
"__component": "shared.slider",
|
||||
"files": ["coffee-art.jpg", "coffee-beans.jpg"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "This shrimp is awesome",
|
||||
"slug": "this-shrimp-is-awesome",
|
||||
"category": {
|
||||
"id": 4
|
||||
},
|
||||
"author": {
|
||||
"id": 1
|
||||
},
|
||||
"description": "Mantis shrimps, or stomatopods, are marine crustaceans of the order Stomatopoda.",
|
||||
"cover": null,
|
||||
"blocks": [
|
||||
{
|
||||
"__component": "shared.rich-text",
|
||||
"body": "## Probant \n\nse Lorem markdownum negat. Argo *saxa* videnda cornuaque hunc qui tanta spes teneas! Obliquis est dicenti est salutat ille tamen iuvenum nostrae dolore. - Colores nocituraque comitata eripiunt - Addit quodcunque solum cui et dextram illis - Nulli meus nec extemplo ille ferebat pressit Se blandita fulvae vox gravem Pittheus cesserunt sanguine herbis tu comitum tenuit. Sui in ruunt; Doridaque maculosae fuissem! Et loqui. \n\n## Abit sua\n\nse Lorem markdownum negat. Argo *saxa* videnda cornuaque hunc qui tanta spes teneas! Obliquis est dicenti est salutat ille tamen iuvenum nostrae dolore. - Colores nocituraque comitata eripiunt - Addit quodcunque solum cui et dextram illis - Nulli meus nec extemplo ille ferebat pressit Se blandita fulvae vox gravem Pittheus cesserunt sanguine herbis tu comitum tenuit. Sui in ruunt; Doridaque maculosae fuissem! Et loqui. "
|
||||
},
|
||||
{
|
||||
"__component": "shared.quote",
|
||||
"title": "Thelonius Monk",
|
||||
"body": "You've got to dig it to dig it, you dig?"
|
||||
},
|
||||
{
|
||||
"__component": "shared.media",
|
||||
"file": "coffee-art.jpg"
|
||||
},
|
||||
{
|
||||
"__component": "shared.rich-text",
|
||||
"body": "## Spatiantia astra \n\nFoeda, medio silva *errandum*: onus formam munere. Mutata bibulis est auxiliare arces etiamnunc verbis virgineo Priamidas illa Thescelus, nam fit locis lucis auras. Exitus hospes gratulor ut pondere [speslimite](http://www.curas.io/figuram); quid habent, Avernales faciente de. Pervenit Ino sonabile supplex cognoscenti vires, Bacchumque errat miserarum venandi dignabere dedisti. Discrimina iuncosaque virgaque tot sine superest [fissus](http://quos.org/sitet.aspx). Non color esset potest non sumit, sed vix arserat. Nisi immo silva tantum pectusque quos pennis quisquam artus!"
|
||||
},
|
||||
{
|
||||
"__component": "shared.slider",
|
||||
"files": ["coffee-art.jpg", "coffee-beans.jpg"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "A bug is becoming a meme on the internet",
|
||||
"slug": "a-bug-is-becoming-a-meme-on-the-internet",
|
||||
"category": {
|
||||
"id": 2
|
||||
},
|
||||
"author": {
|
||||
"id": 2
|
||||
},
|
||||
"description": "How a bug on MySQL is becoming a meme on the internet",
|
||||
"cover": null,
|
||||
"blocks": [
|
||||
{
|
||||
"__component": "shared.rich-text",
|
||||
"body": "## Probant \n\nse Lorem markdownum negat. Argo *saxa* videnda cornuaque hunc qui tanta spes teneas! Obliquis est dicenti est salutat ille tamen iuvenum nostrae dolore. - Colores nocituraque comitata eripiunt - Addit quodcunque solum cui et dextram illis - Nulli meus nec extemplo ille ferebat pressit Se blandita fulvae vox gravem Pittheus cesserunt sanguine herbis tu comitum tenuit. Sui in ruunt; Doridaque maculosae fuissem! Et loqui. \n\n## Abit sua\n\nse Lorem markdownum negat. Argo *saxa* videnda cornuaque hunc qui tanta spes teneas! Obliquis est dicenti est salutat ille tamen iuvenum nostrae dolore. - Colores nocituraque comitata eripiunt - Addit quodcunque solum cui et dextram illis - Nulli meus nec extemplo ille ferebat pressit Se blandita fulvae vox gravem Pittheus cesserunt sanguine herbis tu comitum tenuit. Sui in ruunt; Doridaque maculosae fuissem! Et loqui. "
|
||||
},
|
||||
{
|
||||
"__component": "shared.quote",
|
||||
"title": "Thelonius Monk",
|
||||
"body": "You've got to dig it to dig it, you dig?"
|
||||
},
|
||||
{
|
||||
"__component": "shared.media",
|
||||
"file": "coffee-art.jpg"
|
||||
},
|
||||
{
|
||||
"__component": "shared.rich-text",
|
||||
"body": "## Spatiantia astra \n\nFoeda, medio silva *errandum*: onus formam munere. Mutata bibulis est auxiliare arces etiamnunc verbis virgineo Priamidas illa Thescelus, nam fit locis lucis auras. Exitus hospes gratulor ut pondere [speslimite](http://www.curas.io/figuram); quid habent, Avernales faciente de. Pervenit Ino sonabile supplex cognoscenti vires, Bacchumque errat miserarum venandi dignabere dedisti. Discrimina iuncosaque virgaque tot sine superest [fissus](http://quos.org/sitet.aspx). Non color esset potest non sumit, sed vix arserat. Nisi immo silva tantum pectusque quos pennis quisquam artus!"
|
||||
},
|
||||
{
|
||||
"__component": "shared.slider",
|
||||
"files": ["coffee-art.jpg", "coffee-beans.jpg"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Beautiful picture",
|
||||
"slug": "beautiful-picture",
|
||||
"category": {
|
||||
"id": 4
|
||||
},
|
||||
"author": {
|
||||
"id": 2
|
||||
},
|
||||
"description": "Description of a beautiful picture",
|
||||
"cover": null,
|
||||
"blocks": [
|
||||
{
|
||||
"__component": "shared.rich-text",
|
||||
"body": "## Probant \n\nse Lorem markdownum negat. Argo *saxa* videnda cornuaque hunc qui tanta spes teneas! Obliquis est dicenti est salutat ille tamen iuvenum nostrae dolore. - Colores nocituraque comitata eripiunt - Addit quodcunque solum cui et dextram illis - Nulli meus nec extemplo ille ferebat pressit Se blandita fulvae vox gravem Pittheus cesserunt sanguine herbis tu comitum tenuit. Sui in ruunt; Doridaque maculosae fuissem! Et loqui. \n\n## Abit sua\n\nse Lorem markdownum negat. Argo *saxa* videnda cornuaque hunc qui tanta spes teneas! Obliquis est dicenti est salutat ille tamen iuvenum nostrae dolore. - Colores nocituraque comitata eripiunt - Addit quodcunque solum cui et dextram illis - Nulli meus nec extemplo ille ferebat pressit Se blandita fulvae vox gravem Pittheus cesserunt sanguine herbis tu comitum tenuit. Sui in ruunt; Doridaque maculosae fuissem! Et loqui. "
|
||||
},
|
||||
{
|
||||
"__component": "shared.quote",
|
||||
"title": "Thelonius Monk",
|
||||
"body": "You've got to dig it to dig it, you dig?"
|
||||
},
|
||||
{
|
||||
"__component": "shared.media",
|
||||
"file": "coffee-art.jpg"
|
||||
},
|
||||
{
|
||||
"__component": "shared.rich-text",
|
||||
"body": "## Spatiantia astra \n\nFoeda, medio silva *errandum*: onus formam munere. Mutata bibulis est auxiliare arces etiamnunc verbis virgineo Priamidas illa Thescelus, nam fit locis lucis auras. Exitus hospes gratulor ut pondere [speslimite](http://www.curas.io/figuram); quid habent, Avernales faciente de. Pervenit Ino sonabile supplex cognoscenti vires, Bacchumque errat miserarum venandi dignabere dedisti. Discrimina iuncosaque virgaque tot sine superest [fissus](http://quos.org/sitet.aspx). Non color esset potest non sumit, sed vix arserat. Nisi immo silva tantum pectusque quos pennis quisquam artus!"
|
||||
},
|
||||
{
|
||||
"__component": "shared.slider",
|
||||
"files": ["coffee-art.jpg", "coffee-beans.jpg"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "What's inside a Black Hole",
|
||||
"slug": "what-s-inside-a-black-hole",
|
||||
"category": {
|
||||
"id": 1
|
||||
},
|
||||
"author": {
|
||||
"id": 2
|
||||
},
|
||||
"description": "Maybe the answer is in this article, or not...",
|
||||
"cover": null,
|
||||
"blocks": [
|
||||
{
|
||||
"__component": "shared.rich-text",
|
||||
"body": "## Probant \n\nse Lorem markdownum negat. Argo *saxa* videnda cornuaque hunc qui tanta spes teneas! Obliquis est dicenti est salutat ille tamen iuvenum nostrae dolore. - Colores nocituraque comitata eripiunt - Addit quodcunque solum cui et dextram illis - Nulli meus nec extemplo ille ferebat pressit Se blandita fulvae vox gravem Pittheus cesserunt sanguine herbis tu comitum tenuit. Sui in ruunt; Doridaque maculosae fuissem! Et loqui. \n\n## Abit sua\n\nse Lorem markdownum negat. Argo *saxa* videnda cornuaque hunc qui tanta spes teneas! Obliquis est dicenti est salutat ille tamen iuvenum nostrae dolore. - Colores nocituraque comitata eripiunt - Addit quodcunque solum cui et dextram illis - Nulli meus nec extemplo ille ferebat pressit Se blandita fulvae vox gravem Pittheus cesserunt sanguine herbis tu comitum tenuit. Sui in ruunt; Doridaque maculosae fuissem! Et loqui. "
|
||||
},
|
||||
{
|
||||
"__component": "shared.quote",
|
||||
"title": "Thelonius Monk",
|
||||
"body": "You've got to dig it to dig it, you dig?"
|
||||
},
|
||||
{
|
||||
"__component": "shared.media",
|
||||
"file": "coffee-art.jpg"
|
||||
},
|
||||
{
|
||||
"__component": "shared.rich-text",
|
||||
"body": "## Spatiantia astra \n\nFoeda, medio silva *errandum*: onus formam munere. Mutata bibulis est auxiliare arces etiamnunc verbis virgineo Priamidas illa Thescelus, nam fit locis lucis auras. Exitus hospes gratulor ut pondere [speslimite](http://www.curas.io/figuram); quid habent, Avernales faciente de. Pervenit Ino sonabile supplex cognoscenti vires, Bacchumque errat miserarum venandi dignabere dedisti. Discrimina iuncosaque virgaque tot sine superest [fissus](http://quos.org/sitet.aspx). Non color esset potest non sumit, sed vix arserat. Nisi immo silva tantum pectusque quos pennis quisquam artus!"
|
||||
},
|
||||
{
|
||||
"__component": "shared.slider",
|
||||
"files": ["coffee-art.jpg", "coffee-beans.jpg"]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 49 KiB |
BIN
playground/data/uploads/beautiful-picture.jpg
Normal file
|
After Width: | Height: | Size: 138 KiB |
BIN
playground/data/uploads/coffee-art.jpg
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
playground/data/uploads/coffee-beans.jpg
Normal file
|
After Width: | Height: | Size: 215 KiB |
BIN
playground/data/uploads/coffee-shadow.jpg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
playground/data/uploads/daviddoe@strapi.io.jpg
Normal file
|
After Width: | Height: | Size: 91 KiB |
BIN
playground/data/uploads/default-image.png
Normal file
|
After Width: | Height: | Size: 81 KiB |
BIN
playground/data/uploads/favicon.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
playground/data/uploads/sarahbaker@strapi.io.jpg
Normal file
|
After Width: | Height: | Size: 172 KiB |
BIN
playground/data/uploads/the-internet-s-own-boy.jpg
Normal file
|
After Width: | Height: | Size: 90 KiB |
BIN
playground/data/uploads/this-shrimp-is-awesome.jpg
Normal file
|
After Width: | Height: | Size: 93 KiB |
BIN
playground/data/uploads/we-love-pizza.jpg
Normal file
|
After Width: | Height: | Size: 354 KiB |
BIN
playground/data/uploads/what-s-inside-a-black-hole.jpg
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
0
playground/database/migrations/.gitkeep
Normal file
BIN
playground/favicon.png
Normal file
|
After Width: | Height: | Size: 497 B |
21444
playground/package-lock.json
generated
Normal file
45
playground/package.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "playground",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "A Strapi application",
|
||||
"scripts": {
|
||||
"build": "strapi build",
|
||||
"console": "strapi console",
|
||||
"deploy": "strapi deploy",
|
||||
"dev": "strapi develop",
|
||||
"develop": "strapi develop",
|
||||
"seed:example": "node ./scripts/seed.js",
|
||||
"start": "strapi start",
|
||||
"strapi": "strapi",
|
||||
"upgrade": "npx @strapi/upgrade latest",
|
||||
"upgrade:dry": "npx @strapi/upgrade latest --dry"
|
||||
},
|
||||
"dependencies": {
|
||||
"@strapi/plugin-cloud": "5.35.0",
|
||||
"@strapi/plugin-users-permissions": "5.35.0",
|
||||
"@strapi/strapi": "5.35.0",
|
||||
"better-sqlite3": "12.4.1",
|
||||
"fs-extra": "^10.0.0",
|
||||
"mime-types": "^2.1.27",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0",
|
||||
"react-router-dom": "^6.0.0",
|
||||
"strapi-plugin-checkbox-list": "file:.yalc/strapi-plugin-checkbox-list",
|
||||
"styled-components": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^18",
|
||||
"@types/react-dom": "^18",
|
||||
"typescript": "^5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0.0 <=24.x.x",
|
||||
"npm": ">=6.0.0"
|
||||
},
|
||||
"strapi": {
|
||||
"uuid": "6dac7976-406d-4ad4-bbd1-030627875cc6",
|
||||
"installId": "146243096d458c50511ec4ae3a4d04aac96988ee0cb22d6a209d34a4cfb24649"
|
||||
}
|
||||
}
|
||||
3
playground/public/robots.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
# To prevent search engines from seeing the site altogether, uncomment the next two lines:
|
||||
# User-Agent: *
|
||||
# Disallow: /
|
||||
0
playground/public/uploads/.gitkeep
Normal file
274
playground/scripts/seed.js
Normal file
@@ -0,0 +1,274 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const mime = require('mime-types');
|
||||
const { categories, authors, articles, global, about } = require('../data/data.json');
|
||||
|
||||
async function seedExampleApp() {
|
||||
const shouldImportSeedData = await isFirstRun();
|
||||
|
||||
if (shouldImportSeedData) {
|
||||
try {
|
||||
console.log('Setting up the template...');
|
||||
await importSeedData();
|
||||
console.log('Ready to go');
|
||||
} catch (error) {
|
||||
console.log('Could not import seed data');
|
||||
console.error(error);
|
||||
}
|
||||
} else {
|
||||
console.log(
|
||||
'Seed data has already been imported. We cannot reimport unless you clear your database first.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function isFirstRun() {
|
||||
const pluginStore = strapi.store({
|
||||
environment: strapi.config.environment,
|
||||
type: 'type',
|
||||
name: 'setup',
|
||||
});
|
||||
const initHasRun = await pluginStore.get({ key: 'initHasRun' });
|
||||
await pluginStore.set({ key: 'initHasRun', value: true });
|
||||
return !initHasRun;
|
||||
}
|
||||
|
||||
async function setPublicPermissions(newPermissions) {
|
||||
// Find the ID of the public role
|
||||
const publicRole = await strapi.query('plugin::users-permissions.role').findOne({
|
||||
where: {
|
||||
type: 'public',
|
||||
},
|
||||
});
|
||||
|
||||
// Create the new permissions and link them to the public role
|
||||
const allPermissionsToCreate = [];
|
||||
Object.keys(newPermissions).map((controller) => {
|
||||
const actions = newPermissions[controller];
|
||||
const permissionsToCreate = actions.map((action) => {
|
||||
return strapi.query('plugin::users-permissions.permission').create({
|
||||
data: {
|
||||
action: `api::${controller}.${controller}.${action}`,
|
||||
role: publicRole.id,
|
||||
},
|
||||
});
|
||||
});
|
||||
allPermissionsToCreate.push(...permissionsToCreate);
|
||||
});
|
||||
await Promise.all(allPermissionsToCreate);
|
||||
}
|
||||
|
||||
function getFileSizeInBytes(filePath) {
|
||||
const stats = fs.statSync(filePath);
|
||||
const fileSizeInBytes = stats['size'];
|
||||
return fileSizeInBytes;
|
||||
}
|
||||
|
||||
function getFileData(fileName) {
|
||||
const filePath = path.join('data', 'uploads', fileName);
|
||||
// Parse the file metadata
|
||||
const size = getFileSizeInBytes(filePath);
|
||||
const ext = fileName.split('.').pop();
|
||||
const mimeType = mime.lookup(ext || '') || '';
|
||||
|
||||
return {
|
||||
filepath: filePath,
|
||||
originalFileName: fileName,
|
||||
size,
|
||||
mimetype: mimeType,
|
||||
};
|
||||
}
|
||||
|
||||
async function uploadFile(file, name) {
|
||||
return strapi
|
||||
.plugin('upload')
|
||||
.service('upload')
|
||||
.upload({
|
||||
files: file,
|
||||
data: {
|
||||
fileInfo: {
|
||||
alternativeText: `An image uploaded to Strapi called ${name}`,
|
||||
caption: name,
|
||||
name,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Create an entry and attach files if there are any
|
||||
async function createEntry({ model, entry }) {
|
||||
try {
|
||||
// Actually create the entry in Strapi
|
||||
await strapi.documents(`api::${model}.${model}`).create({
|
||||
data: entry,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error({ model, entry, error });
|
||||
}
|
||||
}
|
||||
|
||||
async function checkFileExistsBeforeUpload(files) {
|
||||
const existingFiles = [];
|
||||
const uploadedFiles = [];
|
||||
const filesCopy = [...files];
|
||||
|
||||
for (const fileName of filesCopy) {
|
||||
// Check if the file already exists in Strapi
|
||||
const fileWhereName = await strapi.query('plugin::upload.file').findOne({
|
||||
where: {
|
||||
name: fileName.replace(/\..*$/, ''),
|
||||
},
|
||||
});
|
||||
|
||||
if (fileWhereName) {
|
||||
// File exists, don't upload it
|
||||
existingFiles.push(fileWhereName);
|
||||
} else {
|
||||
// File doesn't exist, upload it
|
||||
const fileData = getFileData(fileName);
|
||||
const fileNameNoExtension = fileName.split('.').shift();
|
||||
const [file] = await uploadFile(fileData, fileNameNoExtension);
|
||||
uploadedFiles.push(file);
|
||||
}
|
||||
}
|
||||
const allFiles = [...existingFiles, ...uploadedFiles];
|
||||
// If only one file then return only that file
|
||||
return allFiles.length === 1 ? allFiles[0] : allFiles;
|
||||
}
|
||||
|
||||
async function updateBlocks(blocks) {
|
||||
const updatedBlocks = [];
|
||||
for (const block of blocks) {
|
||||
if (block.__component === 'shared.media') {
|
||||
const uploadedFiles = await checkFileExistsBeforeUpload([block.file]);
|
||||
// Copy the block to not mutate directly
|
||||
const blockCopy = { ...block };
|
||||
// Replace the file name on the block with the actual file
|
||||
blockCopy.file = uploadedFiles;
|
||||
updatedBlocks.push(blockCopy);
|
||||
} else if (block.__component === 'shared.slider') {
|
||||
// Get files already uploaded to Strapi or upload new files
|
||||
const existingAndUploadedFiles = await checkFileExistsBeforeUpload(block.files);
|
||||
// Copy the block to not mutate directly
|
||||
const blockCopy = { ...block };
|
||||
// Replace the file names on the block with the actual files
|
||||
blockCopy.files = existingAndUploadedFiles;
|
||||
// Push the updated block
|
||||
updatedBlocks.push(blockCopy);
|
||||
} else {
|
||||
// Just push the block as is
|
||||
updatedBlocks.push(block);
|
||||
}
|
||||
}
|
||||
|
||||
return updatedBlocks;
|
||||
}
|
||||
|
||||
async function importArticles() {
|
||||
for (const article of articles) {
|
||||
const cover = await checkFileExistsBeforeUpload([`${article.slug}.jpg`]);
|
||||
const updatedBlocks = await updateBlocks(article.blocks);
|
||||
|
||||
await createEntry({
|
||||
model: 'article',
|
||||
entry: {
|
||||
...article,
|
||||
cover,
|
||||
blocks: updatedBlocks,
|
||||
// Make sure it's not a draft
|
||||
publishedAt: Date.now(),
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function importGlobal() {
|
||||
const favicon = await checkFileExistsBeforeUpload(['favicon.png']);
|
||||
const shareImage = await checkFileExistsBeforeUpload(['default-image.png']);
|
||||
return createEntry({
|
||||
model: 'global',
|
||||
entry: {
|
||||
...global,
|
||||
favicon,
|
||||
// Make sure it's not a draft
|
||||
publishedAt: Date.now(),
|
||||
defaultSeo: {
|
||||
...global.defaultSeo,
|
||||
shareImage,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function importAbout() {
|
||||
const updatedBlocks = await updateBlocks(about.blocks);
|
||||
|
||||
await createEntry({
|
||||
model: 'about',
|
||||
entry: {
|
||||
...about,
|
||||
blocks: updatedBlocks,
|
||||
// Make sure it's not a draft
|
||||
publishedAt: Date.now(),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function importCategories() {
|
||||
for (const category of categories) {
|
||||
await createEntry({ model: 'category', entry: category });
|
||||
}
|
||||
}
|
||||
|
||||
async function importAuthors() {
|
||||
for (const author of authors) {
|
||||
const avatar = await checkFileExistsBeforeUpload([author.avatar]);
|
||||
|
||||
await createEntry({
|
||||
model: 'author',
|
||||
entry: {
|
||||
...author,
|
||||
avatar,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function importSeedData() {
|
||||
// Allow read of application content types
|
||||
await setPublicPermissions({
|
||||
article: ['find', 'findOne'],
|
||||
category: ['find', 'findOne'],
|
||||
author: ['find', 'findOne'],
|
||||
global: ['find', 'findOne'],
|
||||
about: ['find', 'findOne'],
|
||||
});
|
||||
|
||||
// Create all entries
|
||||
await importCategories();
|
||||
await importAuthors();
|
||||
await importArticles();
|
||||
await importGlobal();
|
||||
await importAbout();
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const { createStrapi, compileStrapi } = require('@strapi/strapi');
|
||||
|
||||
const appContext = await compileStrapi();
|
||||
const app = await createStrapi(appContext).load();
|
||||
|
||||
app.log.level = 'error';
|
||||
|
||||
await seedExampleApp();
|
||||
await app.destroy();
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
37
playground/src/admin/app.example.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import type { StrapiApp } from '@strapi/strapi/admin';
|
||||
|
||||
export default {
|
||||
config: {
|
||||
locales: [
|
||||
// 'ar',
|
||||
// 'fr',
|
||||
// 'cs',
|
||||
// 'de',
|
||||
// 'dk',
|
||||
// 'es',
|
||||
// 'he',
|
||||
// 'id',
|
||||
// 'it',
|
||||
// 'ja',
|
||||
// 'ko',
|
||||
// 'ms',
|
||||
// 'nl',
|
||||
// 'no',
|
||||
// 'pl',
|
||||
// 'pt-BR',
|
||||
// 'pt',
|
||||
// 'ru',
|
||||
// 'sk',
|
||||
// 'sv',
|
||||
// 'th',
|
||||
// 'tr',
|
||||
// 'uk',
|
||||
// 'vi',
|
||||
// 'zh-Hans',
|
||||
// 'zh',
|
||||
],
|
||||
},
|
||||
bootstrap(app: StrapiApp) {
|
||||
console.log(app);
|
||||
},
|
||||
};
|
||||
20
playground/src/admin/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
||||
"allowJs": false,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx"
|
||||
},
|
||||
"include": ["../plugins/**/admin/src/**/*", "./"],
|
||||
"exclude": ["node_modules/", "build/", "dist/", "**/*.test.ts"]
|
||||
}
|
||||
12
playground/src/admin/vite.config.example.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { mergeConfig, type UserConfig } from 'vite';
|
||||
|
||||
export default (config: UserConfig) => {
|
||||
// Important: always return the modified config
|
||||
return mergeConfig(config, {
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': '/src',
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
0
playground/src/api/.gitkeep
Normal file
23
playground/src/api/about/content-types/about/schema.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"kind": "singleType",
|
||||
"collectionName": "abouts",
|
||||
"info": {
|
||||
"singularName": "about",
|
||||
"pluralName": "abouts",
|
||||
"displayName": "About",
|
||||
"description": "Write about yourself and the content you create"
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false
|
||||
},
|
||||
"pluginOptions": {},
|
||||
"attributes": {
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"blocks": {
|
||||
"type": "dynamiczone",
|
||||
"components": ["shared.media", "shared.quote", "shared.rich-text", "shared.slider"]
|
||||
}
|
||||
}
|
||||
}
|
||||
7
playground/src/api/about/controllers/about.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* about controller
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreController('api::about.about');
|
||||
7
playground/src/api/about/routes/about.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* about router.
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreRouter('api::about.about');
|
||||
7
playground/src/api/about/services/about.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* about service.
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreService('api::about.about');
|
||||
49
playground/src/api/article/content-types/article/schema.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"kind": "collectionType",
|
||||
"collectionName": "articles",
|
||||
"info": {
|
||||
"singularName": "article",
|
||||
"pluralName": "articles",
|
||||
"displayName": "Article",
|
||||
"description": "Create your blog content"
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": true
|
||||
},
|
||||
"pluginOptions": {},
|
||||
"attributes": {
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "text",
|
||||
"maxLength": 80
|
||||
},
|
||||
"slug": {
|
||||
"type": "uid",
|
||||
"targetField": "title"
|
||||
},
|
||||
"cover": {
|
||||
"type": "media",
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"allowedTypes": ["images", "files", "videos"]
|
||||
},
|
||||
"author": {
|
||||
"type": "relation",
|
||||
"relation": "manyToOne",
|
||||
"target": "api::author.author",
|
||||
"inversedBy": "articles"
|
||||
},
|
||||
"category": {
|
||||
"type": "relation",
|
||||
"relation": "manyToOne",
|
||||
"target": "api::category.category",
|
||||
"inversedBy": "articles"
|
||||
},
|
||||
"blocks": {
|
||||
"type": "dynamiczone",
|
||||
"components": ["shared.media", "shared.quote", "shared.rich-text", "shared.slider"]
|
||||
}
|
||||
}
|
||||
}
|
||||
7
playground/src/api/article/controllers/article.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* article controller
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreController('api::article.article');
|
||||
7
playground/src/api/article/routes/article.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* article router.
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreRouter('api::article.article');
|
||||
7
playground/src/api/article/services/article.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* article service.
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreService('api::article.article');
|
||||
34
playground/src/api/author/content-types/author/schema.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"kind": "collectionType",
|
||||
"collectionName": "authors",
|
||||
"info": {
|
||||
"singularName": "author",
|
||||
"pluralName": "authors",
|
||||
"displayName": "Author",
|
||||
"description": "Create authors for your content"
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false
|
||||
},
|
||||
"pluginOptions": {},
|
||||
"attributes": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"avatar": {
|
||||
"type": "media",
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"allowedTypes": ["images", "files", "videos"]
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"articles": {
|
||||
"type": "relation",
|
||||
"relation": "oneToMany",
|
||||
"target": "api::article.article",
|
||||
"mappedBy": "author"
|
||||
}
|
||||
}
|
||||
}
|
||||
7
playground/src/api/author/controllers/author.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* author controller
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreController('api::author.author');
|
||||
7
playground/src/api/author/routes/author.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* author router.
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreRouter('api::author.author');
|
||||
7
playground/src/api/author/services/author.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* author service.
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreService('api::author.author');
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"kind": "collectionType",
|
||||
"collectionName": "categories",
|
||||
"info": {
|
||||
"singularName": "category",
|
||||
"pluralName": "categories",
|
||||
"displayName": "Category",
|
||||
"description": "Organize your content into categories"
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false
|
||||
},
|
||||
"pluginOptions": {},
|
||||
"attributes": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "uid"
|
||||
},
|
||||
"articles": {
|
||||
"type": "relation",
|
||||
"relation": "oneToMany",
|
||||
"target": "api::article.article",
|
||||
"mappedBy": "category"
|
||||
},
|
||||
"description": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
7
playground/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
playground/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
playground/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');
|
||||
35
playground/src/api/global/content-types/global/schema.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"kind": "singleType",
|
||||
"collectionName": "globals",
|
||||
"info": {
|
||||
"singularName": "global",
|
||||
"pluralName": "globals",
|
||||
"displayName": "Global",
|
||||
"description": "Define global settings"
|
||||
},
|
||||
"options": {
|
||||
"draftAndPublish": false
|
||||
},
|
||||
"pluginOptions": {},
|
||||
"attributes": {
|
||||
"siteName": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"favicon": {
|
||||
"type": "media",
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"allowedTypes": ["images", "files", "videos"]
|
||||
},
|
||||
"siteDescription": {
|
||||
"type": "text",
|
||||
"required": true
|
||||
},
|
||||
"defaultSeo": {
|
||||
"type": "component",
|
||||
"repeatable": false,
|
||||
"component": "shared.seo"
|
||||
}
|
||||
}
|
||||
}
|
||||
7
playground/src/api/global/controllers/global.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* global controller
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreController('api::global.global');
|
||||
7
playground/src/api/global/routes/global.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* global router.
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreRouter('api::global.global');
|
||||
7
playground/src/api/global/services/global.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* global service.
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreService('api::global.global');
|
||||
15
playground/src/components/shared/media.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"collectionName": "components_shared_media",
|
||||
"info": {
|
||||
"displayName": "Media",
|
||||
"icon": "file-video"
|
||||
},
|
||||
"options": {},
|
||||
"attributes": {
|
||||
"file": {
|
||||
"allowedTypes": ["images", "files", "videos"],
|
||||
"type": "media",
|
||||
"multiple": false
|
||||
}
|
||||
}
|
||||
}
|
||||
16
playground/src/components/shared/quote.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"collectionName": "components_shared_quotes",
|
||||
"info": {
|
||||
"displayName": "Quote",
|
||||
"icon": "indent"
|
||||
},
|
||||
"options": {},
|
||||
"attributes": {
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"body": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
14
playground/src/components/shared/rich-text.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"collectionName": "components_shared_rich_texts",
|
||||
"info": {
|
||||
"displayName": "Rich text",
|
||||
"icon": "align-justify",
|
||||
"description": ""
|
||||
},
|
||||
"options": {},
|
||||
"attributes": {
|
||||
"body": {
|
||||
"type": "richtext"
|
||||
}
|
||||
}
|
||||
}
|
||||
26
playground/src/components/shared/seo.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"collectionName": "components_shared_seos",
|
||||
"info": {
|
||||
"name": "Seo",
|
||||
"icon": "allergies",
|
||||
"displayName": "Seo",
|
||||
"description": ""
|
||||
},
|
||||
"options": {},
|
||||
"attributes": {
|
||||
"metaTitle": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"metaDescription": {
|
||||
"type": "text",
|
||||
"required": true
|
||||
},
|
||||
"shareImage": {
|
||||
"type": "media",
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"allowedTypes": ["images"]
|
||||
}
|
||||
}
|
||||
}
|
||||
17
playground/src/components/shared/slider.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"collectionName": "components_shared_sliders",
|
||||
"info": {
|
||||
"displayName": "Slider",
|
||||
"icon": "address-book",
|
||||
"description": ""
|
||||
},
|
||||
"options": {},
|
||||
"attributes": {
|
||||
"files": {
|
||||
"type": "media",
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"allowedTypes": ["images"]
|
||||
}
|
||||
}
|
||||
}
|
||||
0
playground/src/extensions/.gitkeep
Normal file
20
playground/src/index.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
// import type { Core } from '@strapi/strapi';
|
||||
|
||||
export default {
|
||||
/**
|
||||
* An asynchronous register function that runs before
|
||||
* your application is initialized.
|
||||
*
|
||||
* This gives you an opportunity to extend code.
|
||||
*/
|
||||
register(/* { strapi }: { strapi: Core.Strapi } */) {},
|
||||
|
||||
/**
|
||||
* An asynchronous bootstrap function that runs before
|
||||
* your application gets started.
|
||||
*
|
||||
* This gives you an opportunity to set up your data model,
|
||||
* run jobs, or perform some special logic.
|
||||
*/
|
||||
bootstrap(/* { strapi }: { strapi: Core.Strapi } */) {},
|
||||
};
|
||||
43
playground/tsconfig.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "CommonJS",
|
||||
"moduleResolution": "Node",
|
||||
"lib": ["ES2020"],
|
||||
"target": "ES2019",
|
||||
"strict": false,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"incremental": true,
|
||||
"esModuleInterop": true,
|
||||
"resolveJsonModule": true,
|
||||
"noEmitOnError": true,
|
||||
"noImplicitThis": true,
|
||||
"outDir": "dist",
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": [
|
||||
// Include root files
|
||||
"./",
|
||||
// Include all ts files
|
||||
"./**/*.ts",
|
||||
// Include all js files
|
||||
"./**/*.js",
|
||||
// Force the JSON files in the src folder to be included
|
||||
"src/**/*.json"
|
||||
],
|
||||
|
||||
"exclude": [
|
||||
"node_modules/",
|
||||
"build/",
|
||||
"dist/",
|
||||
".cache/",
|
||||
".tmp/",
|
||||
|
||||
// Do not include admin files in the server compilation
|
||||
"src/admin/",
|
||||
// Do not include test files
|
||||
"**/*.test.*",
|
||||
// Do not include plugins in the server compilation
|
||||
"src/plugins/**"
|
||||
]
|
||||
}
|
||||
75
playground/types/generated/components.d.ts
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
import type { Schema, Struct } from '@strapi/strapi';
|
||||
|
||||
export interface SharedMedia extends Struct.ComponentSchema {
|
||||
collectionName: 'components_shared_media';
|
||||
info: {
|
||||
displayName: 'Media';
|
||||
icon: 'file-video';
|
||||
};
|
||||
attributes: {
|
||||
file: Schema.Attribute.Media<'images' | 'files' | 'videos'>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface SharedQuote extends Struct.ComponentSchema {
|
||||
collectionName: 'components_shared_quotes';
|
||||
info: {
|
||||
displayName: 'Quote';
|
||||
icon: 'indent';
|
||||
};
|
||||
attributes: {
|
||||
body: Schema.Attribute.Text;
|
||||
title: Schema.Attribute.String;
|
||||
};
|
||||
}
|
||||
|
||||
export interface SharedRichText extends Struct.ComponentSchema {
|
||||
collectionName: 'components_shared_rich_texts';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'Rich text';
|
||||
icon: 'align-justify';
|
||||
};
|
||||
attributes: {
|
||||
body: Schema.Attribute.RichText;
|
||||
};
|
||||
}
|
||||
|
||||
export interface SharedSeo extends Struct.ComponentSchema {
|
||||
collectionName: 'components_shared_seos';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'Seo';
|
||||
icon: 'allergies';
|
||||
name: 'Seo';
|
||||
};
|
||||
attributes: {
|
||||
metaDescription: Schema.Attribute.Text & Schema.Attribute.Required;
|
||||
metaTitle: Schema.Attribute.String & Schema.Attribute.Required;
|
||||
shareImage: Schema.Attribute.Media<'images'>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface SharedSlider extends Struct.ComponentSchema {
|
||||
collectionName: 'components_shared_sliders';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'Slider';
|
||||
icon: 'address-book';
|
||||
};
|
||||
attributes: {
|
||||
files: Schema.Attribute.Media<'images', true>;
|
||||
};
|
||||
}
|
||||
|
||||
declare module '@strapi/strapi' {
|
||||
export module Public {
|
||||
export interface ComponentSchemas {
|
||||
'shared.media': SharedMedia;
|
||||
'shared.quote': SharedQuote;
|
||||
'shared.rich-text': SharedRichText;
|
||||
'shared.seo': SharedSeo;
|
||||
'shared.slider': SharedSlider;
|
||||
}
|
||||
}
|
||||
}
|
||||
979
playground/types/generated/contentTypes.d.ts
vendored
Normal file
@@ -0,0 +1,979 @@
|
||||
import type { Schema, Struct } from '@strapi/strapi';
|
||||
|
||||
export interface AdminApiToken extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'strapi_api_tokens';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'Api Token';
|
||||
name: 'Api Token';
|
||||
pluralName: 'api-tokens';
|
||||
singularName: 'api-token';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
pluginOptions: {
|
||||
'content-manager': {
|
||||
visible: false;
|
||||
};
|
||||
'content-type-builder': {
|
||||
visible: false;
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
accessKey: Schema.Attribute.String &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}>;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
description: Schema.Attribute.String &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}> &
|
||||
Schema.Attribute.DefaultTo<''>;
|
||||
encryptedKey: Schema.Attribute.Text &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}>;
|
||||
expiresAt: Schema.Attribute.DateTime;
|
||||
lastUsedAt: Schema.Attribute.DateTime;
|
||||
lifespan: Schema.Attribute.BigInteger;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'admin::api-token'> &
|
||||
Schema.Attribute.Private;
|
||||
name: Schema.Attribute.String &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.Unique &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}>;
|
||||
permissions: Schema.Attribute.Relation<'oneToMany', 'admin::api-token-permission'>;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
type: Schema.Attribute.Enumeration<['read-only', 'full-access', 'custom']> &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.DefaultTo<'read-only'>;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface AdminApiTokenPermission extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'strapi_api_token_permissions';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'API Token Permission';
|
||||
name: 'API Token Permission';
|
||||
pluralName: 'api-token-permissions';
|
||||
singularName: 'api-token-permission';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
pluginOptions: {
|
||||
'content-manager': {
|
||||
visible: false;
|
||||
};
|
||||
'content-type-builder': {
|
||||
visible: false;
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
action: Schema.Attribute.String &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}>;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'admin::api-token-permission'> &
|
||||
Schema.Attribute.Private;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
token: Schema.Attribute.Relation<'manyToOne', 'admin::api-token'>;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface AdminPermission extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'admin_permissions';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'Permission';
|
||||
name: 'Permission';
|
||||
pluralName: 'permissions';
|
||||
singularName: 'permission';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
pluginOptions: {
|
||||
'content-manager': {
|
||||
visible: false;
|
||||
};
|
||||
'content-type-builder': {
|
||||
visible: false;
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
action: Schema.Attribute.String &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}>;
|
||||
actionParameters: Schema.Attribute.JSON & Schema.Attribute.DefaultTo<{}>;
|
||||
conditions: Schema.Attribute.JSON & Schema.Attribute.DefaultTo<[]>;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'admin::permission'> &
|
||||
Schema.Attribute.Private;
|
||||
properties: Schema.Attribute.JSON & Schema.Attribute.DefaultTo<{}>;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
role: Schema.Attribute.Relation<'manyToOne', 'admin::role'>;
|
||||
subject: Schema.Attribute.String &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}>;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface AdminRole extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'admin_roles';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'Role';
|
||||
name: 'Role';
|
||||
pluralName: 'roles';
|
||||
singularName: 'role';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
pluginOptions: {
|
||||
'content-manager': {
|
||||
visible: false;
|
||||
};
|
||||
'content-type-builder': {
|
||||
visible: false;
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
code: Schema.Attribute.String &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.Unique &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}>;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
description: Schema.Attribute.String;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'admin::role'> & Schema.Attribute.Private;
|
||||
name: Schema.Attribute.String &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.Unique &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}>;
|
||||
permissions: Schema.Attribute.Relation<'oneToMany', 'admin::permission'>;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
users: Schema.Attribute.Relation<'manyToMany', 'admin::user'>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface AdminSession extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'strapi_sessions';
|
||||
info: {
|
||||
description: 'Session Manager storage';
|
||||
displayName: 'Session';
|
||||
name: 'Session';
|
||||
pluralName: 'sessions';
|
||||
singularName: 'session';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
pluginOptions: {
|
||||
'content-manager': {
|
||||
visible: false;
|
||||
};
|
||||
'content-type-builder': {
|
||||
visible: false;
|
||||
};
|
||||
i18n: {
|
||||
localized: false;
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
absoluteExpiresAt: Schema.Attribute.DateTime & Schema.Attribute.Private;
|
||||
childId: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
deviceId: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.Private;
|
||||
expiresAt: Schema.Attribute.DateTime & Schema.Attribute.Required & Schema.Attribute.Private;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'admin::session'> &
|
||||
Schema.Attribute.Private;
|
||||
origin: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.Private;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
sessionId: Schema.Attribute.String &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.Private &
|
||||
Schema.Attribute.Unique;
|
||||
status: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
type: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
userId: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface AdminTransferToken extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'strapi_transfer_tokens';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'Transfer Token';
|
||||
name: 'Transfer Token';
|
||||
pluralName: 'transfer-tokens';
|
||||
singularName: 'transfer-token';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
pluginOptions: {
|
||||
'content-manager': {
|
||||
visible: false;
|
||||
};
|
||||
'content-type-builder': {
|
||||
visible: false;
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
accessKey: Schema.Attribute.String &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}>;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
description: Schema.Attribute.String &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}> &
|
||||
Schema.Attribute.DefaultTo<''>;
|
||||
expiresAt: Schema.Attribute.DateTime;
|
||||
lastUsedAt: Schema.Attribute.DateTime;
|
||||
lifespan: Schema.Attribute.BigInteger;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'admin::transfer-token'> &
|
||||
Schema.Attribute.Private;
|
||||
name: Schema.Attribute.String &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.Unique &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}>;
|
||||
permissions: Schema.Attribute.Relation<'oneToMany', 'admin::transfer-token-permission'>;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface AdminTransferTokenPermission extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'strapi_transfer_token_permissions';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'Transfer Token Permission';
|
||||
name: 'Transfer Token Permission';
|
||||
pluralName: 'transfer-token-permissions';
|
||||
singularName: 'transfer-token-permission';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
pluginOptions: {
|
||||
'content-manager': {
|
||||
visible: false;
|
||||
};
|
||||
'content-type-builder': {
|
||||
visible: false;
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
action: Schema.Attribute.String &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}>;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'admin::transfer-token-permission'> &
|
||||
Schema.Attribute.Private;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
token: Schema.Attribute.Relation<'manyToOne', 'admin::transfer-token'>;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface AdminUser extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'admin_users';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'User';
|
||||
name: 'User';
|
||||
pluralName: 'users';
|
||||
singularName: 'user';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
pluginOptions: {
|
||||
'content-manager': {
|
||||
visible: false;
|
||||
};
|
||||
'content-type-builder': {
|
||||
visible: false;
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
blocked: Schema.Attribute.Boolean &
|
||||
Schema.Attribute.Private &
|
||||
Schema.Attribute.DefaultTo<false>;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
email: Schema.Attribute.Email &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.Private &
|
||||
Schema.Attribute.Unique &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 6;
|
||||
}>;
|
||||
firstname: Schema.Attribute.String &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}>;
|
||||
isActive: Schema.Attribute.Boolean &
|
||||
Schema.Attribute.Private &
|
||||
Schema.Attribute.DefaultTo<false>;
|
||||
lastname: Schema.Attribute.String &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}>;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'admin::user'> & Schema.Attribute.Private;
|
||||
password: Schema.Attribute.Password &
|
||||
Schema.Attribute.Private &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 6;
|
||||
}>;
|
||||
preferedLanguage: Schema.Attribute.String;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
registrationToken: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
resetPasswordToken: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
roles: Schema.Attribute.Relation<'manyToMany', 'admin::role'> & Schema.Attribute.Private;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
username: Schema.Attribute.String;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ApiAboutAbout extends Struct.SingleTypeSchema {
|
||||
collectionName: 'abouts';
|
||||
info: {
|
||||
description: 'Write about yourself and the content you create';
|
||||
displayName: 'About';
|
||||
pluralName: 'abouts';
|
||||
singularName: 'about';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
attributes: {
|
||||
blocks: Schema.Attribute.DynamicZone<
|
||||
['shared.media', 'shared.quote', 'shared.rich-text', 'shared.slider']
|
||||
>;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'api::about.about'> &
|
||||
Schema.Attribute.Private;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
title: Schema.Attribute.String;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ApiArticleArticle extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'articles';
|
||||
info: {
|
||||
description: 'Create your blog content';
|
||||
displayName: 'Article';
|
||||
pluralName: 'articles';
|
||||
singularName: 'article';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: true;
|
||||
};
|
||||
attributes: {
|
||||
author: Schema.Attribute.Relation<'manyToOne', 'api::author.author'>;
|
||||
blocks: Schema.Attribute.DynamicZone<
|
||||
['shared.media', 'shared.quote', 'shared.rich-text', 'shared.slider']
|
||||
>;
|
||||
category: Schema.Attribute.Relation<'manyToOne', 'api::category.category'>;
|
||||
cover: Schema.Attribute.Media<'images' | 'files' | 'videos'>;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
description: Schema.Attribute.Text &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
maxLength: 80;
|
||||
}>;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'api::article.article'> &
|
||||
Schema.Attribute.Private;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
slug: Schema.Attribute.UID<'title'>;
|
||||
title: Schema.Attribute.String;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ApiAuthorAuthor extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'authors';
|
||||
info: {
|
||||
description: 'Create authors for your content';
|
||||
displayName: 'Author';
|
||||
pluralName: 'authors';
|
||||
singularName: 'author';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
attributes: {
|
||||
articles: Schema.Attribute.Relation<'oneToMany', 'api::article.article'>;
|
||||
avatar: Schema.Attribute.Media<'images' | 'files' | 'videos'>;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
email: Schema.Attribute.String;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'api::author.author'> &
|
||||
Schema.Attribute.Private;
|
||||
name: Schema.Attribute.String;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ApiCategoryCategory extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'categories';
|
||||
info: {
|
||||
description: 'Organize your content into categories';
|
||||
displayName: 'Category';
|
||||
pluralName: 'categories';
|
||||
singularName: 'category';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
attributes: {
|
||||
articles: Schema.Attribute.Relation<'oneToMany', 'api::article.article'>;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
description: Schema.Attribute.Text;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'api::category.category'> &
|
||||
Schema.Attribute.Private;
|
||||
name: Schema.Attribute.String;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
slug: Schema.Attribute.UID;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ApiGlobalGlobal extends Struct.SingleTypeSchema {
|
||||
collectionName: 'globals';
|
||||
info: {
|
||||
description: 'Define global settings';
|
||||
displayName: 'Global';
|
||||
pluralName: 'globals';
|
||||
singularName: 'global';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
attributes: {
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
defaultSeo: Schema.Attribute.Component<'shared.seo', false>;
|
||||
favicon: Schema.Attribute.Media<'images' | 'files' | 'videos'>;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'api::global.global'> &
|
||||
Schema.Attribute.Private;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
siteDescription: Schema.Attribute.Text & Schema.Attribute.Required;
|
||||
siteName: Schema.Attribute.String & Schema.Attribute.Required;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface PluginContentReleasesRelease extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'strapi_releases';
|
||||
info: {
|
||||
displayName: 'Release';
|
||||
pluralName: 'releases';
|
||||
singularName: 'release';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
pluginOptions: {
|
||||
'content-manager': {
|
||||
visible: false;
|
||||
};
|
||||
'content-type-builder': {
|
||||
visible: false;
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
actions: Schema.Attribute.Relation<'oneToMany', 'plugin::content-releases.release-action'>;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'plugin::content-releases.release'> &
|
||||
Schema.Attribute.Private;
|
||||
name: Schema.Attribute.String & Schema.Attribute.Required;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
releasedAt: Schema.Attribute.DateTime;
|
||||
scheduledAt: Schema.Attribute.DateTime;
|
||||
status: Schema.Attribute.Enumeration<['ready', 'blocked', 'failed', 'done', 'empty']> &
|
||||
Schema.Attribute.Required;
|
||||
timezone: Schema.Attribute.String;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface PluginContentReleasesReleaseAction extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'strapi_release_actions';
|
||||
info: {
|
||||
displayName: 'Release Action';
|
||||
pluralName: 'release-actions';
|
||||
singularName: 'release-action';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
pluginOptions: {
|
||||
'content-manager': {
|
||||
visible: false;
|
||||
};
|
||||
'content-type-builder': {
|
||||
visible: false;
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
contentType: Schema.Attribute.String & Schema.Attribute.Required;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
entryDocumentId: Schema.Attribute.String;
|
||||
isEntryValid: Schema.Attribute.Boolean;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<
|
||||
'oneToMany',
|
||||
'plugin::content-releases.release-action'
|
||||
> &
|
||||
Schema.Attribute.Private;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
release: Schema.Attribute.Relation<'manyToOne', 'plugin::content-releases.release'>;
|
||||
type: Schema.Attribute.Enumeration<['publish', 'unpublish']> & Schema.Attribute.Required;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface PluginI18NLocale extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'i18n_locale';
|
||||
info: {
|
||||
collectionName: 'locales';
|
||||
description: '';
|
||||
displayName: 'Locale';
|
||||
pluralName: 'locales';
|
||||
singularName: 'locale';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
pluginOptions: {
|
||||
'content-manager': {
|
||||
visible: false;
|
||||
};
|
||||
'content-type-builder': {
|
||||
visible: false;
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
code: Schema.Attribute.String & Schema.Attribute.Unique;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'plugin::i18n.locale'> &
|
||||
Schema.Attribute.Private;
|
||||
name: Schema.Attribute.String &
|
||||
Schema.Attribute.SetMinMax<
|
||||
{
|
||||
max: 50;
|
||||
min: 1;
|
||||
},
|
||||
number
|
||||
>;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface PluginReviewWorkflowsWorkflow extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'strapi_workflows';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'Workflow';
|
||||
name: 'Workflow';
|
||||
pluralName: 'workflows';
|
||||
singularName: 'workflow';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
pluginOptions: {
|
||||
'content-manager': {
|
||||
visible: false;
|
||||
};
|
||||
'content-type-builder': {
|
||||
visible: false;
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
contentTypes: Schema.Attribute.JSON &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.DefaultTo<'[]'>;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'plugin::review-workflows.workflow'> &
|
||||
Schema.Attribute.Private;
|
||||
name: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.Unique;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
stageRequiredToPublish: Schema.Attribute.Relation<
|
||||
'oneToOne',
|
||||
'plugin::review-workflows.workflow-stage'
|
||||
>;
|
||||
stages: Schema.Attribute.Relation<'oneToMany', 'plugin::review-workflows.workflow-stage'>;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface PluginReviewWorkflowsWorkflowStage extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'strapi_workflows_stages';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'Stages';
|
||||
name: 'Workflow Stage';
|
||||
pluralName: 'workflow-stages';
|
||||
singularName: 'workflow-stage';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
version: '1.1.0';
|
||||
};
|
||||
pluginOptions: {
|
||||
'content-manager': {
|
||||
visible: false;
|
||||
};
|
||||
'content-type-builder': {
|
||||
visible: false;
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
color: Schema.Attribute.String & Schema.Attribute.DefaultTo<'#4945FF'>;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<
|
||||
'oneToMany',
|
||||
'plugin::review-workflows.workflow-stage'
|
||||
> &
|
||||
Schema.Attribute.Private;
|
||||
name: Schema.Attribute.String;
|
||||
permissions: Schema.Attribute.Relation<'manyToMany', 'admin::permission'>;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
workflow: Schema.Attribute.Relation<'manyToOne', 'plugin::review-workflows.workflow'>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface PluginUploadFile extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'files';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'File';
|
||||
pluralName: 'files';
|
||||
singularName: 'file';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
pluginOptions: {
|
||||
'content-manager': {
|
||||
visible: false;
|
||||
};
|
||||
'content-type-builder': {
|
||||
visible: false;
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
alternativeText: Schema.Attribute.Text;
|
||||
caption: Schema.Attribute.Text;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
ext: Schema.Attribute.String;
|
||||
focalPoint: Schema.Attribute.JSON;
|
||||
folder: Schema.Attribute.Relation<'manyToOne', 'plugin::upload.folder'> &
|
||||
Schema.Attribute.Private;
|
||||
folderPath: Schema.Attribute.String &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.Private &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}>;
|
||||
formats: Schema.Attribute.JSON;
|
||||
hash: Schema.Attribute.String & Schema.Attribute.Required;
|
||||
height: Schema.Attribute.Integer;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'plugin::upload.file'> &
|
||||
Schema.Attribute.Private;
|
||||
mime: Schema.Attribute.String & Schema.Attribute.Required;
|
||||
name: Schema.Attribute.String & Schema.Attribute.Required;
|
||||
previewUrl: Schema.Attribute.Text;
|
||||
provider: Schema.Attribute.String & Schema.Attribute.Required;
|
||||
provider_metadata: Schema.Attribute.JSON;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
related: Schema.Attribute.Relation<'morphToMany'>;
|
||||
size: Schema.Attribute.Decimal & Schema.Attribute.Required;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
url: Schema.Attribute.Text & Schema.Attribute.Required;
|
||||
width: Schema.Attribute.Integer;
|
||||
};
|
||||
}
|
||||
|
||||
export interface PluginUploadFolder extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'upload_folders';
|
||||
info: {
|
||||
displayName: 'Folder';
|
||||
pluralName: 'folders';
|
||||
singularName: 'folder';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
pluginOptions: {
|
||||
'content-manager': {
|
||||
visible: false;
|
||||
};
|
||||
'content-type-builder': {
|
||||
visible: false;
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
children: Schema.Attribute.Relation<'oneToMany', 'plugin::upload.folder'>;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
files: Schema.Attribute.Relation<'oneToMany', 'plugin::upload.file'>;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'plugin::upload.folder'> &
|
||||
Schema.Attribute.Private;
|
||||
name: Schema.Attribute.String &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}>;
|
||||
parent: Schema.Attribute.Relation<'manyToOne', 'plugin::upload.folder'>;
|
||||
path: Schema.Attribute.String &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 1;
|
||||
}>;
|
||||
pathId: Schema.Attribute.Integer & Schema.Attribute.Required & Schema.Attribute.Unique;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface PluginUsersPermissionsPermission extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'up_permissions';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'Permission';
|
||||
name: 'permission';
|
||||
pluralName: 'permissions';
|
||||
singularName: 'permission';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
pluginOptions: {
|
||||
'content-manager': {
|
||||
visible: false;
|
||||
};
|
||||
'content-type-builder': {
|
||||
visible: false;
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
action: Schema.Attribute.String & Schema.Attribute.Required;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'plugin::users-permissions.permission'> &
|
||||
Schema.Attribute.Private;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
role: Schema.Attribute.Relation<'manyToOne', 'plugin::users-permissions.role'>;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
};
|
||||
}
|
||||
|
||||
export interface PluginUsersPermissionsRole extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'up_roles';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'Role';
|
||||
name: 'role';
|
||||
pluralName: 'roles';
|
||||
singularName: 'role';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
};
|
||||
pluginOptions: {
|
||||
'content-manager': {
|
||||
visible: false;
|
||||
};
|
||||
'content-type-builder': {
|
||||
visible: false;
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
description: Schema.Attribute.String;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'plugin::users-permissions.role'> &
|
||||
Schema.Attribute.Private;
|
||||
name: Schema.Attribute.String &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 3;
|
||||
}>;
|
||||
permissions: Schema.Attribute.Relation<'oneToMany', 'plugin::users-permissions.permission'>;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
type: Schema.Attribute.String & Schema.Attribute.Unique;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
users: Schema.Attribute.Relation<'oneToMany', 'plugin::users-permissions.user'>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface PluginUsersPermissionsUser extends Struct.CollectionTypeSchema {
|
||||
collectionName: 'up_users';
|
||||
info: {
|
||||
description: '';
|
||||
displayName: 'User';
|
||||
name: 'user';
|
||||
pluralName: 'users';
|
||||
singularName: 'user';
|
||||
};
|
||||
options: {
|
||||
draftAndPublish: false;
|
||||
timestamps: true;
|
||||
};
|
||||
attributes: {
|
||||
blocked: Schema.Attribute.Boolean & Schema.Attribute.DefaultTo<false>;
|
||||
confirmationToken: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
confirmed: Schema.Attribute.Boolean & Schema.Attribute.DefaultTo<false>;
|
||||
createdAt: Schema.Attribute.DateTime;
|
||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
email: Schema.Attribute.Email &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 6;
|
||||
}>;
|
||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
localizations: Schema.Attribute.Relation<'oneToMany', 'plugin::users-permissions.user'> &
|
||||
Schema.Attribute.Private;
|
||||
password: Schema.Attribute.Password &
|
||||
Schema.Attribute.Private &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 6;
|
||||
}>;
|
||||
provider: Schema.Attribute.String;
|
||||
publishedAt: Schema.Attribute.DateTime;
|
||||
resetPasswordToken: Schema.Attribute.String & Schema.Attribute.Private;
|
||||
role: Schema.Attribute.Relation<'manyToOne', 'plugin::users-permissions.role'>;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
|
||||
username: Schema.Attribute.String &
|
||||
Schema.Attribute.Required &
|
||||
Schema.Attribute.Unique &
|
||||
Schema.Attribute.SetMinMaxLength<{
|
||||
minLength: 3;
|
||||
}>;
|
||||
};
|
||||
}
|
||||
|
||||
declare module '@strapi/strapi' {
|
||||
export module Public {
|
||||
export interface ContentTypeSchemas {
|
||||
'admin::api-token': AdminApiToken;
|
||||
'admin::api-token-permission': AdminApiTokenPermission;
|
||||
'admin::permission': AdminPermission;
|
||||
'admin::role': AdminRole;
|
||||
'admin::session': AdminSession;
|
||||
'admin::transfer-token': AdminTransferToken;
|
||||
'admin::transfer-token-permission': AdminTransferTokenPermission;
|
||||
'admin::user': AdminUser;
|
||||
'api::about.about': ApiAboutAbout;
|
||||
'api::article.article': ApiArticleArticle;
|
||||
'api::author.author': ApiAuthorAuthor;
|
||||
'api::category.category': ApiCategoryCategory;
|
||||
'api::global.global': ApiGlobalGlobal;
|
||||
'plugin::content-releases.release': PluginContentReleasesRelease;
|
||||
'plugin::content-releases.release-action': PluginContentReleasesReleaseAction;
|
||||
'plugin::i18n.locale': PluginI18NLocale;
|
||||
'plugin::review-workflows.workflow': PluginReviewWorkflowsWorkflow;
|
||||
'plugin::review-workflows.workflow-stage': PluginReviewWorkflowsWorkflowStage;
|
||||
'plugin::upload.file': PluginUploadFile;
|
||||
'plugin::upload.folder': PluginUploadFolder;
|
||||
'plugin::users-permissions.permission': PluginUsersPermissionsPermission;
|
||||
'plugin::users-permissions.role': PluginUsersPermissionsRole;
|
||||
'plugin::users-permissions.user': PluginUsersPermissionsUser;
|
||||
}
|
||||
}
|
||||
}
|
||||
7
server/src/bootstrap.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { Core } from '@strapi/strapi';
|
||||
|
||||
const bootstrap = ({ strapi }: { strapi: Core.Strapi }) => {
|
||||
// bootstrap phase
|
||||
};
|
||||
|
||||
export default bootstrap;
|
||||
4
server/src/config/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default {
|
||||
default: {},
|
||||
validator() {},
|
||||
};
|
||||
1
server/src/content-types/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export default {};
|
||||
13
server/src/controllers/controller.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { Core } from '@strapi/strapi';
|
||||
|
||||
const controller = ({ strapi }: { strapi: Core.Strapi }) => ({
|
||||
index(ctx) {
|
||||
ctx.body = strapi
|
||||
.plugin('strapi-plugin-checkbox-list')
|
||||
// the name of the service file & the method.
|
||||
.service('service')
|
||||
.getWelcomeMessage();
|
||||
},
|
||||
});
|
||||
|
||||
export default controller;
|
||||
5
server/src/controllers/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import controller from './controller';
|
||||
|
||||
export default {
|
||||
controller,
|
||||
};
|
||||
7
server/src/destroy.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { Core } from '@strapi/strapi';
|
||||
|
||||
const destroy = ({ strapi }: { strapi: Core.Strapi }) => {
|
||||
// destroy phase
|
||||
};
|
||||
|
||||
export default destroy;
|
||||
30
server/src/index.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Application methods
|
||||
*/
|
||||
import bootstrap from './bootstrap';
|
||||
import destroy from './destroy';
|
||||
import register from './register';
|
||||
|
||||
/**
|
||||
* Plugin server methods
|
||||
*/
|
||||
import config from './config';
|
||||
import contentTypes from './content-types';
|
||||
import controllers from './controllers';
|
||||
import middlewares from './middlewares';
|
||||
import policies from './policies';
|
||||
import routes from './routes';
|
||||
import services from './services';
|
||||
|
||||
export default {
|
||||
register,
|
||||
bootstrap,
|
||||
destroy,
|
||||
config,
|
||||
controllers,
|
||||
routes,
|
||||
services,
|
||||
contentTypes,
|
||||
policies,
|
||||
middlewares,
|
||||
};
|
||||
1
server/src/middlewares/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export default {};
|
||||
1
server/src/policies/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export default {};
|
||||
7
server/src/register.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { Core } from '@strapi/strapi';
|
||||
|
||||
const register = ({ strapi }: { strapi: Core.Strapi }) => {
|
||||
// register phase
|
||||
};
|
||||
|
||||
export default register;
|
||||
4
server/src/routes/admin/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default () => ({
|
||||
type: 'admin',
|
||||
routes: [],
|
||||
});
|
||||
14
server/src/routes/content-api/index.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
export default () => ({
|
||||
type: 'content-api',
|
||||
routes: [
|
||||
{
|
||||
method: 'GET',
|
||||
path: '/',
|
||||
// name of the controller file & the method.
|
||||
handler: 'controller.index',
|
||||
config: {
|
||||
policies: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
9
server/src/routes/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import contentAPIRoutes from './content-api';
|
||||
import adminAPIRoutes from './admin';
|
||||
|
||||
const routes = {
|
||||
'content-api': contentAPIRoutes,
|
||||
admin: adminAPIRoutes,
|
||||
};
|
||||
|
||||
export default routes;
|
||||
5
server/src/services/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import service from './service';
|
||||
|
||||
export default {
|
||||
service,
|
||||
};
|
||||
9
server/src/services/service.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { Core } from '@strapi/strapi';
|
||||
|
||||
const service = ({ strapi }: { strapi: Core.Strapi }) => ({
|
||||
getWelcomeMessage() {
|
||||
return 'Welcome to Strapi 🚀';
|
||||
},
|
||||
});
|
||||
|
||||
export default service;
|
||||
10
server/tsconfig.build.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "./tsconfig",
|
||||
"include": ["./src"],
|
||||
"exclude": ["**/*.test.ts"],
|
||||
"compilerOptions": {
|
||||
"rootDir": "../",
|
||||
"baseUrl": ".",
|
||||
"outDir": "./dist"
|
||||
}
|
||||
}
|
||||
8
server/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "@strapi/typescript-utils/tsconfigs/server",
|
||||
"include": ["./src"],
|
||||
"compilerOptions": {
|
||||
"rootDir": "../",
|
||||
"baseUrl": "."
|
||||
}
|
||||
}
|
||||