Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
27 changes: 16 additions & 11 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 All @@ -50,5 +54,6 @@
"engines": {
"node": ">=18.0.0 <=20.x.x",
"npm": ">=6.0.0"
}
},
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
}
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
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);
}
},
};
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 @@ -52,7 +52,7 @@ export default factories.createCoreService(MODULE_ID, ({strapi}) => {

return true
},
async getSubscriptions(accounts: string[]) {
async getSubscriptions(accounts: string[]): Promise<{id: string, account: string, chatId: string}[]> {
return strapi.entityService.findMany(
MODULE_ID,
{
Expand All @@ -65,7 +65,7 @@ export default factories.createCoreService(MODULE_ID, ({strapi}) => {
}
)
},
async getAccountSubscriptions(account: string) {
async getAccountSubscriptions(account: string): Promise<{id: string, account: string, chatId: string}[]> {
return strapi.entityService.findMany(
MODULE_ID,
{
Expand Down
11 changes: 6 additions & 5 deletions src/gen/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7421,6 +7421,8 @@ export interface components {
};
};
};
/** @enum {string} */
location?: "default" | "speechBubble";
/** Format: date-time */
createdAt?: string;
/** Format: date-time */
Expand Down Expand Up @@ -7475,6 +7477,8 @@ export interface components {
dueDate?: string;
/** @example string or id */
thumbnail?: number | string;
/** @enum {string} */
location?: "default" | "speechBubble";
};
};
NotificationTemplateListResponseDataItem: {
Expand All @@ -7499,11 +7503,6 @@ export interface components {
push: boolean;
/** Format: date-time */
dueDate?: string;
/**
* @default default
* @enum {string}
*/
location?: "default" | "speechBubble";
thumbnail?: {
data?: {
id?: number;
Expand Down Expand Up @@ -7730,6 +7729,8 @@ export interface components {
};
};
};
/** @enum {string} */
location?: "default" | "speechBubble";
/** Format: date-time */
createdAt?: string;
/** Format: date-time */
Expand Down
Loading
Loading