Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
24 changes: 14 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cowprotocol/cms-parent",
"version": "0.13.0",
"version": "0.14.0",
"description": "Cow Protocol CMS",
"private": true,
"license": "(MIT OR Apache-2.0)",
Expand All @@ -20,21 +20,25 @@
"postinstall": "npx patch-package"
},
"dependencies": {
"@strapi/plugin-documentation": "4.13.3",
"@strapi/plugin-i18n": "4.13.3",
"@strapi/plugin-users-permissions": "4.13.3",
"@strapi/strapi": "4.13.3",
"@strapi/plugin-documentation": "4.26.1",
"@strapi/plugin-i18n": "4.26.1",
"@strapi/plugin-users-permissions": "4.26.1",
"@strapi/strapi": "4.26.1",
"better-sqlite3": "8.5.0",
"openapi-fetch": "^0.9.3",
"pg": "^8.11.3",
"postinstall-postinstall": "^2.1.0",
"strapi-plugin-import-export-entries": "^1.23.1"
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^5.2.0",
"strapi-plugin-import-export-entries": "^1.23.1",
"styled-components": "^5.2.1"
},
"devDependencies": {
"@strapi/plugin-documentation": "4.13.3",
"@strapi/plugin-i18n": "4.13.3",
"@strapi/plugin-users-permissions": "4.13.3",
"@strapi/strapi": "4.13.3",
"@strapi/plugin-documentation": "4.26.1",
"@strapi/plugin-i18n": "4.26.1",
"@strapi/plugin-users-permissions": "4.26.1",
"@strapi/strapi": "4.26.1",
"better-sqlite3": "8.5.0",
"openapi-typescript": "^6.7.5",
"patch-package": "^8.0.0",
Expand Down
16 changes: 0 additions & 16 deletions patches/@strapi+plugin-upload+4.13.3.patch

This file was deleted.

13 changes: 13 additions & 0 deletions patches/@strapi+plugin-upload+4.26.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/@strapi/plugin-upload/admin/src/components/AssetCard/ImageAssetCard.jsx b/node_modules/@strapi/plugin-upload/admin/src/components/AssetCard/ImageAssetCard.jsx
index 854d800..dcd475f 100644
--- a/node_modules/@strapi/plugin-upload/admin/src/components/AssetCard/ImageAssetCard.jsx
+++ b/node_modules/@strapi/plugin-upload/admin/src/components/AssetCard/ImageAssetCard.jsx
@@ -13,7 +13,7 @@ export const ImageAssetCard = ({ height, width, thumbnail, size, alt, isUrlSigne
const thumbnailUrl = isUrlSigned
? thumbnail
: appendSearchParamsToUrl({
- url: thumbnail,
+ url: thumbnail.startsWith('/') ? location.origin + thumbnail : thumbnail,
params: { updatedAt: props.updatedAt },
});

10 changes: 7 additions & 3 deletions src/api/affiliate/content-types/affiliate/lifecycles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { errors } from "@strapi/utils";
import type { EntityService } from "@strapi/types";

const AFFILIATE_MODULE_ID = "api::affiliate.affiliate" as const;
type AffiliateField = EntityService.Params.Fields.SingleAttribute<typeof AFFILIATE_MODULE_ID>;

const CODE_REGEX = /^[A-Z0-9_-]{5,20}$/;
const codeErrorMsg = 'affiliate code must be 5-20 chars of A-Z, 0-9, "-" or "_"'
Expand All @@ -16,7 +20,7 @@ type AffiliateParamValues = {

type ProgramParamField = keyof AffiliateParamValues;

const PROGRAM_PARAM_FIELDS: readonly ProgramParamField[] = [
const PROGRAM_PARAM_FIELDS: readonly AffiliateField[] = [
"rewardAmount",
"triggerVolume",
"timeCapDays",
Expand All @@ -26,7 +30,7 @@ const PROGRAM_PARAM_FIELDS: readonly ProgramParamField[] = [
"revenueSplitDaoPct",
];

const IMMUTABLE_FIELDS = [
const IMMUTABLE_FIELDS: AffiliateField[] = [
"code",
"walletAddress",
"signedMessage",
Expand Down Expand Up @@ -178,7 +182,7 @@ export default {
if (!IMMUTABLE_FIELDS.some((field) => hasOwn(data, field))) return;

const existing = await strapi.entityService.findOne(
"api::affiliate.affiliate",
AFFILIATE_MODULE_ID,
id,
{ fields: IMMUTABLE_FIELDS }
);
Expand Down
3 changes: 2 additions & 1 deletion src/api/affiliate/documentation/1.0.0/affiliate.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
3 changes: 2 additions & 1 deletion src/api/announcement/documentation/1.0.0/announcement.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
3 changes: 2 additions & 1 deletion src/api/article/documentation/1.0.0/article.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
3 changes: 2 additions & 1 deletion src/api/author/documentation/1.0.0/author.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
3 changes: 2 additions & 1 deletion src/api/bonding-pool/documentation/1.0.0/bonding-pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
3 changes: 2 additions & 1 deletion src/api/category/documentation/1.0.0/category.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
7 changes: 4 additions & 3 deletions src/api/docs/controllers/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ export default {
async getSwaggerDocs(ctx) {
try {
const { major, minor, patch } = ctx.params;
const version =
const version = (
major && minor && patch
? `${major}.${minor}.${patch}`
: strapi.plugins.documentation.config("info.version", "1.0.0");
: strapi.plugins.documentation.config("info.version", "1.0.0")
) as string;

const openAPISpecsPath = path.join(
"src",
Expand All @@ -27,7 +28,7 @@ export default {
ctx.send(response);
} catch (e) {
strapi.log.error(e);
ctx.badRequest(null, e.message);
ctx.badRequest(null, (e as Error).message);
}
},
};
3 changes: 2 additions & 1 deletion src/api/environment/documentation/1.0.0/environment.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
3 changes: 2 additions & 1 deletion src/api/faq-category/documentation/1.0.0/faq-category.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
3 changes: 2 additions & 1 deletion src/api/faq-question/documentation/1.0.0/faq-question.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
3 changes: 2 additions & 1 deletion src/api/global/documentation/1.0.0/global.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
3 changes: 2 additions & 1 deletion src/api/network/documentation/1.0.0/network.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
3 changes: 2 additions & 1 deletion src/api/notification/documentation/1.0.0/notification.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
15 changes: 7 additions & 8 deletions src/api/notification/services/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
*/

import { factories } from '@strapi/strapi';
import type { EntityService } from '@strapi/types';

const MODULE_ID = 'api::notification.notification'
const NOTIFICATIONS_CONSUMER_MODULE_ID = 'api::notifications-consumer.notifications-consumer'
const MODULE_ID = 'api::notification.notification' as const
const NOTIFICATIONS_CONSUMER_MODULE_ID = 'api::notifications-consumer.notifications-consumer' as const
const SINGLETON_ID = 1
const NOTIFICATIONS_LIMIT = 50

const NOTIFICATIONS_POPULATE = {
const NOTIFICATIONS_POPULATE: EntityService.Params.Populate.ObjectNotation<typeof MODULE_ID> = {
notification_template: {
fields: ['id', 'title', 'description', 'url', 'push', 'location'],
populate: {
Expand All @@ -18,7 +19,7 @@ const NOTIFICATIONS_POPULATE = {
}
}
}
} as const
}

const notificationsTemplateFilter = (push: boolean) => ({
$or: [
Expand Down Expand Up @@ -72,7 +73,7 @@ export default factories.createCoreService(MODULE_ID, ({ strapi }) => {
id: notification.id,
account: notification.account,
title: notification.notification_template.title,
description: templateNotification(notification.notification_template.description, notification.data),
description: templateNotification(notification.notification_template.description, notification.data as Record<string, string>),
dueDate: notification.notification_template.dueDate,
url: notification.notification_template.url,
createdAt: notification.createdAt,
Expand All @@ -82,9 +83,7 @@ export default factories.createCoreService(MODULE_ID, ({ strapi }) => {
},
async getPushNotifications() {
const push = true
const notificationsConsumer = await strapi.entityService.findOne(NOTIFICATIONS_CONSUMER_MODULE_ID, SINGLETON_ID, {
populate: ['id', 'lastConsumedNotificationDate']

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • id is always returned, no need to populate it.
  • lastConsumedNotificationDate (if it’s a simple field like datetime) is also returned by default.

})
const notificationsConsumer = await strapi.entityService.findOne(NOTIFICATIONS_CONSUMER_MODULE_ID, SINGLETON_ID)

const lastConsumedNotificationDate = notificationsConsumer?.lastConsumedNotificationDate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
3 changes: 2 additions & 1 deletion src/api/page/documentation/1.0.0/page.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
3 changes: 2 additions & 1 deletion src/api/solver/documentation/1.0.0/solver.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@
"deprecated": false,
"required": false,
"schema": {
"type": "object"
"type": "object",
"additionalProperties": true
},
"style": "deepObject"
},
Expand Down
Loading
Loading