diff --git a/README.md b/README.md index 34b59ff..a2717dd 100644 --- a/README.md +++ b/README.md @@ -10,32 +10,45 @@ Swagger Docs: # 👨‍💻 Develop -Some requiremets are: +Some requirements are: -- At least Node v16 (use a LTS version) +- Node v18 or v20 (use an LTS version) - Yarn - PostgreSQL (optional), for local dev is easier to use sqlite3 (the default). Alternatively you can use PostgreSQL ## Run locally using sqlite3 -The CMS relies on a database. The simplest is to use `Sqlite` for development. +The CMS relies on a database. The simplest is to use **Sqlite** for development (it will be created automatically at `data/sqlite.db` when you start the app). -You actually don't need to do anything for this! If you run the project with `yarn dev`, it will automatically create a sqlite database in `data/sqlite.db` +**Steps:** -``` -yarn dev -``` +1. **Build the project** (required before running): -Then visit: + ```bash + yarn build + ``` -- **Admin**: +2. **Create a `.env` file** and set at least `APP_KEYS` (required for the app to start): -On its basic setup, you don't need to add any configuration parameter, however you might want to do so. You can do this by creating a `.env` file. + ```bash + cp .env.example .env + ``` -```bash -# Create an ENV file from the example -cp .env.example .env -``` + Edit `.env` and set `APP_KEYS` to a comma-separated list of secret keys, for example: + + ``` + APP_KEYS="mySecretKey1,mySecretKey2" + ``` + + You can leave other values as in the example for local dev, or adjust them as needed (see [Strapi environment config](https://docs.strapi.io/dev-docs/configurations/environment)). + +3. **Start the dev server:** + + ```bash + yarn dev + ``` + +4. **Visit** and create your local admin user. ## Dev locally using PostreSQL @@ -64,7 +77,7 @@ yarn dev # 👷‍♀️ Build -Before running the server for the first time, you need to build it: +Before running the server for the first time, you need to build it (see [Run locally using sqlite3](#run-locally-using-sqlite3) for the full setup). To build: ```bash yarn build diff --git a/package.json b/package.json index aafbeea..1ed0837 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "uuid": "e47cb3b3-cc8d-4b31-bc86-634b30862787" }, "engines": { - "node": ">=16.0.0 <=20.x.x", + "node": ">=18.0.0 <=20.x.x", "npm": ">=6.0.0" } } diff --git a/src/api/notification-template/content-types/notification-template/schema.json b/src/api/notification-template/content-types/notification-template/schema.json index 84f9c49..a9e0dbb 100644 --- a/src/api/notification-template/content-types/notification-template/schema.json +++ b/src/api/notification-template/content-types/notification-template/schema.json @@ -38,6 +38,14 @@ "allowedTypes": [ "images" ] + }, + "location": { + "type": "enumeration", + "enum": [ + "default", + "speechBubble" + ], + "default": "default" } } } diff --git a/src/api/notification/content-types/notification/schema.json b/src/api/notification/content-types/notification/schema.json index 69f7fb4..5842a4c 100644 --- a/src/api/notification/content-types/notification/schema.json +++ b/src/api/notification/content-types/notification/schema.json @@ -19,11 +19,6 @@ "data": { "type": "json" }, - "location": { - "type": "enumeration", - "enum": ["default", "speechBubble"], - "default": "default" - }, "notification_template": { "type": "relation", "relation": "oneToOne", diff --git a/src/api/notification/services/notification.ts b/src/api/notification/services/notification.ts index 004bba3..439b201 100644 --- a/src/api/notification/services/notification.ts +++ b/src/api/notification/services/notification.ts @@ -11,14 +11,14 @@ const NOTIFICATIONS_LIMIT = 50 const NOTIFICATIONS_POPULATE = { notification_template: { - fields: ['id', 'title', 'description', 'url', 'push'], + fields: ['id', 'title', 'description', 'url', 'push', 'location'], populate: { thumbnail: { fields: ['url'] } } } -} +} as const const notificationsTemplateFilter = (push: boolean) => ({ $or: [ @@ -76,7 +76,8 @@ export default factories.createCoreService(MODULE_ID, ({ strapi }) => { dueDate: notification.notification_template.dueDate, url: notification.notification_template.url, createdAt: notification.createdAt, - thumbnail: notification.notification_template.thumbnail?.url + thumbnail: notification.notification_template.thumbnail?.url, + location: notification.notification_template?.location ?? 'default' })) }, async getPushNotifications() { @@ -94,7 +95,7 @@ export default factories.createCoreService(MODULE_ID, ({ strapi }) => { filters: { notification_template: notificationsTemplateFilter(push), ...(lastConsumedNotificationDate ? { - createdAt: {$gt: lastConsumedNotificationDate} + createdAt: { $gt: lastConsumedNotificationDate } } : undefined) }, populate: NOTIFICATIONS_POPULATE @@ -113,7 +114,7 @@ export default factories.createCoreService(MODULE_ID, ({ strapi }) => { } }); -export function templateNotification(description: string, data: {[key: string]: string}): string { +export function templateNotification(description: string, data: { [key: string]: string }): string { let result = description if (!data) return result diff --git a/src/extensions/documentation/documentation/1.0.0/full_documentation.json b/src/extensions/documentation/documentation/1.0.0/full_documentation.json index 66d8080..fe417e6 100644 --- a/src/extensions/documentation/documentation/1.0.0/full_documentation.json +++ b/src/extensions/documentation/documentation/1.0.0/full_documentation.json @@ -14,7 +14,7 @@ "name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0.html" }, - "x-generation-date": "2026-02-04T15:36:58.456Z" + "x-generation-date": "2026-02-24T17:14:45.265Z" }, "x-strapi-config": { "path": "/documentation", @@ -18332,6 +18332,13 @@ } } }, + "location": { + "type": "string", + "enum": [ + "default", + "speechBubble" + ] + }, "createdAt": { "type": "string", "format": "date-time" @@ -18486,6 +18493,13 @@ } ], "example": "string or id" + }, + "location": { + "type": "string", + "enum": [ + "default", + "speechBubble" + ] } } } @@ -19182,6 +19196,13 @@ } } }, + "location": { + "type": "string", + "enum": [ + "default", + "speechBubble" + ] + }, "createdAt": { "type": "string", "format": "date-time" diff --git a/src/gen/types.ts b/src/gen/types.ts index 969d918..34a04ef 100644 --- a/src/gen/types.ts +++ b/src/gen/types.ts @@ -7499,6 +7499,11 @@ export interface components { push: boolean; /** Format: date-time */ dueDate?: string; + /** + * @default default + * @enum {string} + */ + location?: "default" | "speechBubble"; thumbnail?: { data?: { id?: number; diff --git a/src/plugins/import-notifications/package.json b/src/plugins/import-notifications/package.json index 0492441..bbf84f2 100644 --- a/src/plugins/import-notifications/package.json +++ b/src/plugins/import-notifications/package.json @@ -41,7 +41,7 @@ } ], "engines": { - "node": ">=16.0.0 <=20.x.x", + "node": ">=18.0.0 <=20.x.x", "npm": ">=6.0.0" }, "scripts": {