初始化Strapi 5项目

This commit is contained in:
于洋 2025-07-21 16:11:15 +08:00
commit 17530a4bb7
62 changed files with 20679 additions and 0 deletions

7
.env.example Executable file
View File

@ -0,0 +1,7 @@
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

131
.gitignore vendored Executable file
View File

@ -0,0 +1,131 @@
############################
# 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
############################
.yarn/*
!.yarn/cache
!.yarn/unplugged
!.yarn/patches
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.pnp.*
yarn-error.log
############################
# Tests
############################
coverage
############################
# Strapi
############################
.env
license.txt
exports
.strapi
dist
build
.strapi-updater.json
.strapi-cloud.json

View File

@ -0,0 +1 @@

61
README.md Executable file
View 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>

27
cms.kdesign.top.key Executable file
View File

@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAvbRGna2uCpX4+xiJ/pvCFZMEk6n9T5r8Vz7eVjTsTOuFBrlP
C7YCt6dcj8s/SkJzSjsXCOMQqBexmDRHyqL2uH5Osgdmd7DiCEqL5+2of1mARpAS
iliAVmxJl9NtVCTtdqzvkoJ/lzyez1Qo2pbWjyfcyrE6HDKhcknM5wOK5cHiAj79
zlHSpNERpMK6ENDiVGiT6dgu6l3BdHaU8l8CZD7bdauqPLbiAnzpnTm5ncO6+gTu
lVjMjF8zNfZGJT7hQUyz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KslelHYq+7BZlD16UBrfHsGXyRgyq9r2K+pE3W523+GpfmY22XBMtO
eErOrGECgYAXPlQRToO+oZ7rpCLYhoDQ4I5LaTkaI1aUp9JHpkYD+5pv64cxv8Um
zMhbX93tKNGlCVtcDI2NG71HALV+dNJ6sNObLjHy0PMB6joGpqcIqmbV4JKlnc8l
73KA2Rum+mZF8XRgi1uBkw3DIza/qj00wl8q8sjxWzJSr3zw4nruXg==
-----END RSA PRIVATE KEY-----

83
cms.kdesign.top.pem Executable file
View File

@ -0,0 +1,83 @@
-----BEGIN CERTIFICATE-----
MIIF9jCCBN6gAwIBAgIQCcrTZRwGj+7FblUpnJL52zANBgkqhkiG9w0BAQsFADBu
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
d3cuZGlnaWNlcnQuY29tMS0wKwYDVQQDEyRFbmNyeXB0aW9uIEV2ZXJ5d2hlcmUg
RFYgVExTIENBIC0gRzIwHhcNMjUwNjEwMDAwMDAwWhcNMjUwOTA5MjM1OTU5WjAa
MRgwFgYDVQQDEw9jbXMua2Rlc2lnbi50b3AwggEiMA0GCSqGSIb3DQEBAQUAA4IB
DwAwggEKAoIBAQC9tEadra4Klfj7GIn+m8IVkwSTqf1PmvxXPt5WNOxM64UGuU8L
tgK3p1yPyz9KQnNKOxcI4xCoF7GYNEfKova4fk6yB2Z3sOIISovn7ah/WYBGkBKK
WIBWbEmX021UJO12rO+Sgn+XPJ7PVCjaltaPJ9zKsTocMqFyScznA4rlweICPv3O
UdKk0RGkwroQ0OJUaJPp2C7qXcF0dpTyXwJkPtt1q6o8tuICfOmdObmdw7r6BO6V
WMyMXzM19kYlPuFBTLNRvDdf7agRJ2sXYZMsfr3uDoptVv21KJCnR9HUXc/V3oYc
iqgNtEU/xim55oQwIKK6SiiWUOLj0N/8Nin5AgMBAAGjggLiMIIC3jAfBgNVHSME
GDAWgBR435GQX+7erPbFdevVTFVT7yRKtjAdBgNVHQ4EFg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-----

17
config/admin.ts Executable file
View File

@ -0,0 +1,17 @@
export default ({ env }) => ({
auth: {
secret: env('ADMIN_JWT_SECRET'),
},
apiToken: {
salt: env('API_TOKEN_SALT'),
},
transfer: {
token: {
salt: env('TRANSFER_TOKEN_SALT'),
},
},
flags: {
nps: env.bool('FLAG_NPS', true),
promoteEE: env.bool('FLAG_PROMOTE_EE', true),
},
});

7
config/api.ts Executable file
View File

@ -0,0 +1,7 @@
export default {
rest: {
defaultLimit: 25,
maxLimit: 100,
withCount: true,
},
};

60
config/database.ts Executable file
View 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', 'dbfile/data.db')),
},
useNullAsDefault: true,
},
};
return {
connection: {
client,
...connections[client],
acquireConnectionTimeout: env.int('DATABASE_CONNECTION_TIMEOUT', 60000),
},
};
};

12
config/middlewares.ts Executable file
View 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
config/plugins.ts Executable file
View File

@ -0,0 +1 @@
export default () => ({});

7
config/server.ts Executable file
View File

@ -0,0 +1,7 @@
export default ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 8082),
app: {
keys: env.array('APP_KEYS'),
},
});

241
data/data.json Executable file
View 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"]
}
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 KiB

BIN
data/uploads/coffee-art.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
data/uploads/coffee-beans.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

BIN
data/uploads/coffee-shadow.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 KiB

BIN
data/uploads/default-image.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 KiB

BIN
data/uploads/favicon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

BIN
data/uploads/we-love-pizza.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 933 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

0
database/migrations/.gitkeep Executable file
View File

BIN
dbfile/data.db Executable file

Binary file not shown.

BIN
favicon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

18162
package-lock.json generated Executable file

File diff suppressed because it is too large Load Diff

46
package.json Executable file
View File

@ -0,0 +1,46 @@
{
"name": "kd-cms",
"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",
"startprod": "npm run build & npm run start",
"upgrade": "npx @strapi/upgrade latest",
"upgrade:dry": "npx @strapi/upgrade latest --dry"
},
"dependencies": {
"@strapi/plugin-cloud": "5.12.7",
"@strapi/plugin-users-permissions": "5.12.7",
"@strapi/strapi": "5.12.7",
"better-sqlite3": "11.3.0",
"fs-extra": "^10.0.0",
"kd-cms": "file:",
"mime-types": "^2.1.27",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "^6.0.0",
"styled-components": "^6.0.0"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"typescript": "^5"
},
"engines": {
"node": ">=18.0.0 <=22.x.x",
"npm": ">=6.0.0"
},
"strapi": {
"uuid": "b4f3786c-cbff-41f9-bb54-86951616d786",
"installId": "3fe3db428aa45dca27afeab38183d28f527fd0ec5b5057441d6047a479974eff"
}
}

3
public/robots.txt Executable file
View File

@ -0,0 +1,3 @@
# To prevent search engines from seeing the site altogether, uncomment the next two lines:
# User-Agent: *
# Disallow: /

0
public/uploads/.gitkeep Executable file
View File

274
scripts/seed.js Executable file
View 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
src/admin/app.example.tsx Executable file
View 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);
},
};

37
src/admin/app.tsx Executable file
View 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
src/admin/tsconfig.json Executable file
View 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"]
}

View 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',
},
},
});
};

15
src/admin/vite.config.ts Executable file
View File

@ -0,0 +1,15 @@
import { mergeConfig, type UserConfig } from 'vite';
export default (config: UserConfig) => {
// Important: always return the modified config
return mergeConfig(config, {
resolve: {
alias: {
'@': '/src',
},
server: {
allowedHosts: ['cms.yangprivate.site']
}
},
});
};

0
src/api/.gitkeep Executable file
View File

View File

@ -0,0 +1,13 @@
export default {
async beforeCreate(event) {
if (!event.params.data.locale) {
event.params.data.locale = 'zh'; // 设为默认值
}
},
async beforeUpdate(event) {
// 如果以后你允许改locale也可以在这里处理
if (!event.params.data.locale) {
event.params.data.locale = 'zh';
}
},
};

View File

@ -0,0 +1,90 @@
{
"kind": "collectionType",
"collectionName": "examples",
"info": {
"singularName": "example",
"pluralName": "examples",
"displayName": "服务案例",
"description": ""
},
"options": {
"draftAndPublish": true
},
"attributes": {
"brandname_cn": {
"type": "string"
},
"projectname_cn": {
"type": "string"
},
"brandname_en": {
"type": "string"
},
"projectname_en": {
"type": "string"
},
"headimage": {
"type": "media",
"multiple": false,
"required": false,
"allowedTypes": [
"images",
"files",
"videos",
"audios"
]
},
"content": {
"type": "text"
},
"projectcode": {
"type": "string"
},
"images": {
"type": "media",
"multiple": true,
"required": false,
"allowedTypes": [
"images",
"files",
"videos",
"audios"
]
},
"example_type": {
"type": "string"
},
"mobileheadimage": {
"type": "media",
"multiple": false,
"required": false,
"allowedTypes": [
"images",
"files",
"videos",
"audios"
]
},
"headvideo": {
"type": "media",
"multiple": false,
"required": false,
"allowedTypes": [
"images",
"files",
"videos",
"audios"
]
},
"mobileheadvideo": {
"allowedTypes": [
"images",
"files",
"videos",
"audios"
],
"type": "media",
"multiple": false
}
}
}

View File

@ -0,0 +1,20 @@
import { Context } from 'koa';
import exampleDistinctService from '../services/example-distinct';
export default {
/**
* GET /examples/distinct?field=xxx
*/
async getDistinct(ctx: Context) {
const { field } = ctx.request.query as { field?: string };
if (!field) {
ctx.throw(400, 'Missing `field` query parameter');
}
// 调用 service 层
const result = await exampleDistinctService.fetchDistinct(field);
ctx.body = result;
},
};

View File

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

View File

@ -0,0 +1,12 @@
export default {
routes: [
{
method: 'GET',
path: '/examples/distinct',
handler: 'example-distinct.getDistinct',
config: {
auth: false, // 如需鉴权请设为 true
},
},
],
};

View File

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

View File

@ -0,0 +1,15 @@
const fetchDistinct = async (field: string): Promise<unknown[]> => {
// 使用类型断言绕过 TS 检查
const records = await strapi.db.query('api::example.example').findMany({
select: [field],
distinct: [field],
} as any);
// 提取唯一字段值并去除 undefined/null
const set = new Set(records.map((item: Record<string, any>) => item[field]).filter((v) => v !== undefined && v !== null));
return Array.from(set);
};
export default {
fetchDistinct,
};

View File

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

View File

@ -0,0 +1,27 @@
{
"kind": "collectionType",
"collectionName": "wanteds",
"info": {
"singularName": "wanted",
"pluralName": "wanteds",
"displayName": "招聘信息",
"description": ""
},
"options": {
"draftAndPublish": true
},
"attributes": {
"jobname": {
"type": "string"
},
"location": {
"type": "string"
},
"role": {
"type": "text"
},
"requirements": {
"type": "text"
}
}
}

View File

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

View File

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

View File

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

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

View File

@ -0,0 +1,16 @@
{
"collectionName": "components_shared_quotes",
"info": {
"displayName": "Quote",
"icon": "indent"
},
"options": {},
"attributes": {
"title": {
"type": "string"
},
"body": {
"type": "text"
}
}
}

View File

@ -0,0 +1,14 @@
{
"collectionName": "components_shared_rich_texts",
"info": {
"displayName": "Rich text",
"icon": "align-justify",
"description": ""
},
"options": {},
"attributes": {
"body": {
"type": "richtext"
}
}
}

26
src/components/shared/seo.json Executable file
View 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"]
}
}
}

View 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
src/extensions/.gitkeep Executable file
View File

20
src/index.ts Executable file
View 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
tsconfig.json Executable file
View 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
types/generated/components.d.ts vendored Executable file
View 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;
}
}
}

974
types/generated/contentTypes.d.ts vendored Executable file
View File

@ -0,0 +1,974 @@
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<''>;
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 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 ApiExampleExample extends Struct.CollectionTypeSchema {
collectionName: 'examples';
info: {
description: '';
displayName: '\u670D\u52A1\u6848\u4F8B';
pluralName: 'examples';
singularName: 'example';
};
options: {
draftAndPublish: true;
};
attributes: {
brandname_cn: Schema.Attribute.String;
brandname_en: Schema.Attribute.String;
content: Schema.Attribute.Text;
createdAt: Schema.Attribute.DateTime;
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
Schema.Attribute.Private;
example_type: Schema.Attribute.String;
headimage: Schema.Attribute.Media<'images' | 'files' | 'videos' | 'audios'>;
headvideo: Schema.Attribute.Media<'images' | 'files' | 'videos' | 'audios'>;
images: Schema.Attribute.Media<
'images' | 'files' | 'videos' | 'audios',
true
>;
locale: Schema.Attribute.String & Schema.Attribute.Private;
localizations: Schema.Attribute.Relation<
'oneToMany',
'api::example.example'
> &
Schema.Attribute.Private;
mobileheadimage: Schema.Attribute.Media<
'images' | 'files' | 'videos' | 'audios'
>;
mobileheadvideo: Schema.Attribute.Media<
'images' | 'files' | 'videos' | 'audios'
>;
projectcode: Schema.Attribute.String;
projectname_cn: Schema.Attribute.String;
projectname_en: Schema.Attribute.String;
publishedAt: Schema.Attribute.DateTime;
updatedAt: Schema.Attribute.DateTime;
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
Schema.Attribute.Private;
};
}
export interface ApiWantedWanted extends Struct.CollectionTypeSchema {
collectionName: 'wanteds';
info: {
description: '';
displayName: '\u62DB\u8058\u4FE1\u606F';
pluralName: 'wanteds';
singularName: 'wanted';
};
options: {
draftAndPublish: true;
};
attributes: {
createdAt: Schema.Attribute.DateTime;
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
Schema.Attribute.Private;
jobname: Schema.Attribute.String;
locale: Schema.Attribute.String & Schema.Attribute.Private;
localizations: Schema.Attribute.Relation<
'oneToMany',
'api::wanted.wanted'
> &
Schema.Attribute.Private;
location: Schema.Attribute.String;
publishedAt: Schema.Attribute.DateTime;
requirements: Schema.Attribute.Text;
role: Schema.Attribute.Text;
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.String;
caption: Schema.Attribute.String;
createdAt: Schema.Attribute.DateTime;
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
Schema.Attribute.Private;
ext: Schema.Attribute.String;
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.String;
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.String & 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::transfer-token': AdminTransferToken;
'admin::transfer-token-permission': AdminTransferTokenPermission;
'admin::user': AdminUser;
'api::example.example': ApiExampleExample;
'api::wanted.wanted': ApiWantedWanted;
'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;
}
}
}