From 2cebfe90bdebe4e5c5878d444b02a76bdb8400ac Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Tue, 16 Sep 2025 15:30:07 +0300 Subject: [PATCH] add new entity customer_setting --- .../customer-setting/schema.json | 24 ++++++++++++ .../content-types/customer/schema.json | 6 +++ .../content-types/subscription/schema.json | 5 --- types/generated/contentTypes.d.ts | 38 +++++++++++++++++-- 4 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 src/api/customer/content-types/customer-setting/schema.json diff --git a/src/api/customer/content-types/customer-setting/schema.json b/src/api/customer/content-types/customer-setting/schema.json new file mode 100644 index 0000000..13b1a6a --- /dev/null +++ b/src/api/customer/content-types/customer-setting/schema.json @@ -0,0 +1,24 @@ +{ + "kind": "collectionType", + "collectionName": "customer_settings", + "info": { + "singularName": "customer-setting", + "pluralName": "customer-settings", + "displayName": "CustomerSettings" + }, + "options": { + "draftAndPublish": false + }, + "pluginOptions": {}, + "attributes": { + "autoRenewSubscription": { + "type": "boolean" + }, + "customer": { + "type": "relation", + "relation": "oneToOne", + "target": "api::customer.customer", + "mappedBy": "customer_setting" + } + } +} diff --git a/src/api/customer/content-types/customer/schema.json b/src/api/customer/content-types/customer/schema.json index a9bb5ec..7fa6042 100644 --- a/src/api/customer/content-types/customer/schema.json +++ b/src/api/customer/content-types/customer/schema.json @@ -87,6 +87,12 @@ "relation": "oneToMany", "target": "api::subscription-reward.subscription-reward", "mappedBy": "owner" + }, + "customer_setting": { + "type": "relation", + "relation": "oneToOne", + "target": "api::customer.customer-setting", + "inversedBy": "customer" } } } diff --git a/src/api/subscription/content-types/subscription/schema.json b/src/api/subscription/content-types/subscription/schema.json index 8ab2cea..6ca7622 100644 --- a/src/api/subscription/content-types/subscription/schema.json +++ b/src/api/subscription/content-types/subscription/schema.json @@ -26,11 +26,6 @@ "type": "datetime", "required": true }, - "autoRenew": { - "type": "boolean", - "required": true, - "default": false - }, "subscription_history": { "type": "relation", "relation": "oneToOne", diff --git a/types/generated/contentTypes.d.ts b/types/generated/contentTypes.d.ts index 1ae836e..4c341b3 100644 --- a/types/generated/contentTypes.d.ts +++ b/types/generated/contentTypes.d.ts @@ -390,6 +390,10 @@ export interface ApiCustomerCustomer extends Struct.CollectionTypeSchema { createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; + customer_setting: Schema.Attribute.Relation< + 'oneToOne', + 'api::customer.customer-setting' + >; invited: Schema.Attribute.Relation<'manyToMany', 'api::customer.customer'>; invitedBy: Schema.Attribute.Relation< 'manyToMany', @@ -434,6 +438,36 @@ export interface ApiCustomerCustomer extends Struct.CollectionTypeSchema { }; } +export interface ApiCustomerCustomerSetting + extends Struct.CollectionTypeSchema { + collectionName: 'customer_settings'; + info: { + displayName: 'CustomerSettings'; + pluralName: 'customer-settings'; + singularName: 'customer-setting'; + }; + options: { + draftAndPublish: false; + }; + attributes: { + autoRenewSubscription: Schema.Attribute.Boolean; + createdAt: Schema.Attribute.DateTime; + createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & + Schema.Attribute.Private; + customer: Schema.Attribute.Relation<'oneToOne', 'api::customer.customer'>; + locale: Schema.Attribute.String & Schema.Attribute.Private; + localizations: Schema.Attribute.Relation< + 'oneToMany', + 'api::customer.customer-setting' + > & + Schema.Attribute.Private; + publishedAt: Schema.Attribute.DateTime; + updatedAt: Schema.Attribute.DateTime; + updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & + Schema.Attribute.Private; + }; +} + export interface ApiOrderOrder extends Struct.CollectionTypeSchema { collectionName: 'orders'; info: { @@ -728,9 +762,6 @@ export interface ApiSubscriptionSubscription active: Schema.Attribute.Boolean & Schema.Attribute.Required & Schema.Attribute.DefaultTo; - autoRenew: Schema.Attribute.Boolean & - Schema.Attribute.Required & - Schema.Attribute.DefaultTo; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; @@ -1271,6 +1302,7 @@ declare module '@strapi/strapi' { 'admin::transfer-token-permission': AdminTransferTokenPermission; 'admin::user': AdminUser; 'api::customer.customer': ApiCustomerCustomer; + 'api::customer.customer-setting': ApiCustomerCustomerSetting; 'api::order.order': ApiOrderOrder; 'api::service.service': ApiServiceService; 'api::slot.slot': ApiSlotSlot;