From efe34ba945ddc2d524a8b0051319298abe2d8ab5 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Thu, 30 Jan 2025 18:56:18 +0300 Subject: [PATCH] upgrade for slots & orders functional --- .../content-types/customer/schema.json | 6 ------ src/api/order/content-types/order/schema.json | 18 +++++++++--------- src/api/slot/content-types/slot/schema.json | 4 ++-- types/generated/contentTypes.d.ts | 8 ++++---- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/api/customer/content-types/customer/schema.json b/src/api/customer/content-types/customer/schema.json index 36c1a09..88923f0 100644 --- a/src/api/customer/content-types/customer/schema.json +++ b/src/api/customer/content-types/customer/schema.json @@ -70,12 +70,6 @@ }, "photoUrl": { "type": "string" - }, - "masterOrders": { - "type": "relation", - "relation": "oneToMany", - "target": "api::order.order", - "mappedBy": "master" } } } diff --git a/src/api/order/content-types/order/schema.json b/src/api/order/content-types/order/schema.json index 137c3fc..185f4ab 100644 --- a/src/api/order/content-types/order/schema.json +++ b/src/api/order/content-types/order/schema.json @@ -29,12 +29,6 @@ "service": { "type": "text" }, - "slot": { - "type": "relation", - "relation": "oneToOne", - "target": "api::slot.slot", - "mappedBy": "orders" - }, "client": { "type": "relation", "relation": "manyToOne", @@ -50,11 +44,17 @@ "orderNumber": { "type": "integer" }, - "master": { + "slot": { "type": "relation", "relation": "manyToOne", - "target": "api::customer.customer", - "inversedBy": "masterOrders" + "target": "api::slot.slot", + "inversedBy": "orders" + }, + "datestart": { + "type": "datetime" + }, + "dateend": { + "type": "datetime" } } } diff --git a/src/api/slot/content-types/slot/schema.json b/src/api/slot/content-types/slot/schema.json index 6843a7e..c0d6f7b 100644 --- a/src/api/slot/content-types/slot/schema.json +++ b/src/api/slot/content-types/slot/schema.json @@ -30,9 +30,9 @@ }, "orders": { "type": "relation", - "relation": "oneToOne", + "relation": "oneToMany", "target": "api::order.order", - "inversedBy": "slot" + "mappedBy": "slot" }, "master": { "type": "relation", diff --git a/types/generated/contentTypes.d.ts b/types/generated/contentTypes.d.ts index 9b58c16..1e0588a 100644 --- a/types/generated/contentTypes.d.ts +++ b/types/generated/contentTypes.d.ts @@ -429,7 +429,6 @@ export interface ApiCustomerCustomer extends Struct.CollectionTypeSchema { 'api::customer.customer' > & Schema.Attribute.Private; - masterOrders: Schema.Attribute.Relation<'oneToMany', 'api::order.order'>; masters: Schema.Attribute.Relation<'manyToMany', 'api::customer.customer'>; name: Schema.Attribute.String & Schema.Attribute.Required; orders: Schema.Attribute.Relation<'oneToMany', 'api::order.order'>; @@ -465,15 +464,16 @@ export interface ApiOrderOrder extends Struct.CollectionTypeSchema { createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; + dateend: Schema.Attribute.DateTime; + datestart: Schema.Attribute.DateTime; locale: Schema.Attribute.String & Schema.Attribute.Private; localizations: Schema.Attribute.Relation<'oneToMany', 'api::order.order'> & Schema.Attribute.Private; - master: Schema.Attribute.Relation<'manyToOne', 'api::customer.customer'>; orderNumber: Schema.Attribute.Integer; price: Schema.Attribute.Integer; publishedAt: Schema.Attribute.DateTime; service: Schema.Attribute.Text; - slot: Schema.Attribute.Relation<'oneToOne', 'api::slot.slot'>; + slot: Schema.Attribute.Relation<'manyToOne', 'api::slot.slot'>; state: Schema.Attribute.Enumeration< ['created', 'scheduled', 'approved', 'completed', 'cancelled'] > & @@ -534,7 +534,7 @@ export interface ApiSlotSlot extends Struct.CollectionTypeSchema { localizations: Schema.Attribute.Relation<'oneToMany', 'api::slot.slot'> & Schema.Attribute.Private; master: Schema.Attribute.Relation<'manyToOne', 'api::customer.customer'>; - orders: Schema.Attribute.Relation<'oneToOne', 'api::order.order'>; + orders: Schema.Attribute.Relation<'oneToMany', 'api::order.order'>; publishedAt: Schema.Attribute.DateTime; state: Schema.Attribute.Enumeration<['open', 'reserved', 'closed']>; updatedAt: Schema.Attribute.DateTime;