Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Strapi v4.9.0 and moving seeding to DEITS #125

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion api/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
HOST=0.0.0.0
PORT=1337
APP_KEYS="toBeModified1,toBeModified2"
API_TOKEN_SALT=tobemodified
ADMIN_JWT_SECRET=tobemodified
JWT_SECRET=tobemodified
TRANSFER_TOKEN_SALT=tobemodified
STRAPI_ADMIN_CLIENT_URL=http://localhost:3000
STRAPI_ADMIN_CLIENT_PREVIEW_SECRET=ARNFCb9zrC9ZHm5hZzCigWivD40icS4s
STRAPI_ADMIN_CLIENT_PREVIEW_SECRET=ARNFCb9zrC9ZHm5hZzCigWivD40icS4s
2 changes: 1 addition & 1 deletion api/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $RECYCLE.BIN/
*.csv
*.dat
*.dmg
*.gz
# *.gz
*.iso
*.jar
*.rar
Expand Down
6 changes: 3 additions & 3 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ You can get started with this project locally on your machine by following the i

## Prerequisites

Be sure to have the correct env variabless:
Be sure to have the correct env variables:

- Strapi:
- `STRAPI_ADMIN_CLIENT_URL=<url-of-nextjs>`
Expand All @@ -20,7 +20,7 @@ Be sure to have the correct env variabless:

- Run the following command in your `./foodadvisor/api` folder:

```
```bash
yarn && yarn seed && yarn develop
```

Expand Down Expand Up @@ -57,4 +57,4 @@ If an article is not related to an editor, no emails will be sent.
- Publishing (RBAC) the article will automatically set the `publicationState` to `Published`
- Setting the `publicationState` to Published will automatically publish the article (RBAC)

Another component has been injected into the list view. For author users, a button allows them to automatically apply a filter `publicationState == Changes requested` so that authors can quickly see any articles not published yet that need changes. For editor users, a button allows them to automatically apply a filter `publicationState == In review` so that editors can quickly see any articles not published yet that need to be reviewed.
Another component has been injected into the list view. For author users, a button allows them to automatically apply a filter `publicationState == Changes requested` so that authors can quickly see any articles not published yet that need changes. For editor users, a button allows them to automatically apply a filter `publicationState == In review` so that editors can quickly see any articles not published yet that need to be reviewed.
9 changes: 7 additions & 2 deletions api/config/admin.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
module.exports = ({ env }) => ({
auth: {
secret: env('ADMIN_JWT_SECRET', '37cb4377c425a87b76e93e0435073b73'),
secret: env('ADMIN_JWT_SECRET'),
},
apiToken: {
salt: env('API_TOKEN_SALT', 'KDUVlMFUyDvfN2JnQ/n4wg=='),
salt: env('API_TOKEN_SALT'),
},
transfer: {
token: {
salt: env('TRANSFER_TOKEN_SALT'),
},
},
});
70 changes: 63 additions & 7 deletions api/config/database.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,67 @@
const path = require('path');

module.exports = ({ env }) => ({
connection: {
client: 'sqlite',
module.exports = ({ env }) => {
const client = env('DATABASE_CLIENT', 'sqlite');

const connections = {
mysql: {
connection: {
connectionString: env('DATABASE_URL'),
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: env('DATABASE_FILENAME', '.tmp/data.db'),
},
useNullAsDefault: true,
},
};

return {
connection: {
filename: path.join(__dirname, '..', env('DATABASE_FILENAME', '.tmp/data.db')),
client,
...connections[client],
acquireConnectionTimeout: env.int('DATABASE_CONNECTION_TIMEOUT', 60000),
},
useNullAsDefault: true,
},
});
};
};
3 changes: 3 additions & 0 deletions api/config/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ module.exports = ({ env }) => ({
app: {
keys: env.array('APP_KEYS', ['testKey1', 'testKey2']),
},
webhooks: {
populateRelations: env.bool('WEBHOOKS_POPULATE_RELATIONS', false),
},
cron: {
enabled: true,
tasks: cronTasks,
Expand Down
Binary file renamed api/data.zip → api/data.tar.gz
Binary file not shown.
14 changes: 7 additions & 7 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"devDependencies": {},
"dependencies": {
"@ckeditor/strapi-plugin-ckeditor": "^0.0.7",
"@offset-dev/strapi-calendar": "^0.0.8",
"@strapi/plugin-graphql": "^4.6.1",
"@strapi/plugin-i18n": "4.6.1",
"@offset-dev/strapi-calendar": "^0.0.10",
"@strapi/plugin-graphql": "4.9.0",
"@strapi/plugin-i18n": "4.9.0",
"@strapi/plugin-seo": "^1.8.0",
"@strapi/plugin-users-permissions": "4.6.1",
"@strapi/strapi": "4.6.1",
"@strapi/plugin-users-permissions": "4.9.0",
"@strapi/strapi": "4.9.0",
"@webbio/strapi-plugin-scheduler": "^0.1.2",
"better-sqlite3": "^7.6.2",
"fs-extra": "^10.0.0",
Expand All @@ -32,11 +32,11 @@
"name": "A Strapi developer"
},
"strapi": {
"uuid": "91bcb9c3-39e5-43e4-ac15-05df0813913f"
"uuid": "FOODADVISOR-LOCAL-aa30a9e6-db71-45b0-8100-ad0de728f951"
},
"engines": {
"node": ">=14.x.x <=18.x.x",
"npm": ">=6.0.0"
},
"license": "MIT"
}
}
38 changes: 38 additions & 0 deletions api/src/api/cookie-popup/content-types/cookie-popup/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"kind": "collectionType",
"collectionName": "cookie_popups",
"info": {
"singularName": "cookie-popup",
"pluralName": "cookie-popups",
"displayName": "Cookie Popups"
},
"options": {
"draftAndPublish": false
},
"pluginOptions": {
"i18n": {
"localized": true
},
"content-manager": {
"visible": false
}
},
"attributes": {
"title": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string"
},
"description": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "richtext"
}
}
}
9 changes: 9 additions & 0 deletions api/src/api/cookie-popup/controllers/cookie-popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

/**
* cookie-popup controller
*/

const { createCoreController } = require('@strapi/strapi').factories;

module.exports = createCoreController('api::cookie-popup.cookie-popup');
9 changes: 9 additions & 0 deletions api/src/api/cookie-popup/routes/cookie-popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

/**
* cookie-popup router
*/

const { createCoreRouter } = require('@strapi/strapi').factories;

module.exports = createCoreRouter('api::cookie-popup.cookie-popup');
9 changes: 9 additions & 0 deletions api/src/api/cookie-popup/services/cookie-popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

/**
* cookie-popup service
*/

const { createCoreService } = require('@strapi/strapi').factories;

module.exports = createCoreService('api::cookie-popup.cookie-popup');
Loading