From 789ab07afb401f9561924cbee38f7fd0ffa2bc6a Mon Sep 17 00:00:00 2001 From: julien vdb Date: Thu, 8 May 2025 19:09:17 +0200 Subject: [PATCH] Change direct message schema --- package.json | 2 +- .../content-types/conversation/schema.json | 6 +- .../content-types/direct-message/schema.json | 12 +- .../1.0.0/full_documentation.json | 433 +++++++++++------- types/generated/contentTypes.d.ts | 18 +- 5 files changed, 282 insertions(+), 189 deletions(-) diff --git a/package.json b/package.json index 69c1495..e0cf56a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "harmony-back", - "version": "0.11.2", + "version": "0.11.3", "private": true, "description": "A Strapi application", "scripts": { diff --git a/src/api/conversation/content-types/conversation/schema.json b/src/api/conversation/content-types/conversation/schema.json index c8ff161..d148216 100644 --- a/src/api/conversation/content-types/conversation/schema.json +++ b/src/api/conversation/content-types/conversation/schema.json @@ -4,7 +4,8 @@ "info": { "singularName": "conversation", "pluralName": "conversations", - "displayName": "Conversation" + "displayName": "Conversation", + "description": "" }, "options": { "draftAndPublish": false @@ -24,7 +25,8 @@ "direct_messages": { "type": "relation", "relation": "oneToMany", - "target": "api::direct-message.direct-message" + "target": "api::direct-message.direct-message", + "mappedBy": "conversation" } } } diff --git a/src/api/direct-message/content-types/direct-message/schema.json b/src/api/direct-message/content-types/direct-message/schema.json index 77bcda4..9fd28ef 100644 --- a/src/api/direct-message/content-types/direct-message/schema.json +++ b/src/api/direct-message/content-types/direct-message/schema.json @@ -4,7 +4,8 @@ "info": { "singularName": "direct-message", "pluralName": "direct-messages", - "displayName": "DirectMessage" + "displayName": "DirectMessage", + "description": "" }, "options": { "draftAndPublish": false @@ -17,15 +18,16 @@ "fileUrl": { "type": "string" }, - "user1": { + "author": { "type": "relation", "relation": "oneToOne", "target": "plugin::users-permissions.user" }, - "user2": { + "conversation": { "type": "relation", - "relation": "oneToOne", - "target": "plugin::users-permissions.user" + "relation": "manyToOne", + "target": "api::conversation.conversation", + "inversedBy": "direct_messages" } } } 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 1bfd381..bf724ca 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": "2025-05-06T21:44:09.671Z" + "x-generation-date": "2025-05-08T17:07:50.652Z" }, "x-strapi-config": { "plugins": [ @@ -33665,7 +33665,7 @@ "fileUrl": { "type": "string" }, - "user1": { + "author": { "type": "object", "properties": { "id": { @@ -33676,7 +33676,7 @@ } } }, - "user2": { + "conversation": { "type": "object", "properties": { "id": { @@ -33684,6 +33684,93 @@ }, "documentId": { "type": "string" + }, + "user1": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + } + } + }, + "user2": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + } + } + }, + "direct_messages": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "publishedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + } + } + }, + "locale": { + "type": "string" + }, + "localizations": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + } + } + } } } }, @@ -33788,93 +33875,6 @@ }, "documentId": { "type": "string" - }, - "user1": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "documentId": { - "type": "string" - } - } - }, - "user2": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "documentId": { - "type": "string" - } - } - }, - "direct_messages": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "documentId": { - "type": "string" - } - } - } - }, - "createdAt": { - "type": "string", - "format": "date-time" - }, - "updatedAt": { - "type": "string", - "format": "date-time" - }, - "publishedAt": { - "type": "string", - "format": "date-time" - }, - "createdBy": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "documentId": { - "type": "string" - } - } - }, - "updatedBy": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "documentId": { - "type": "string" - } - } - }, - "locale": { - "type": "string" - }, - "localizations": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "documentId": { - "type": "string" - } - } - } } } } @@ -33907,7 +33907,7 @@ "fileUrl": { "type": "string" }, - "user1": { + "author": { "oneOf": [ { "type": "integer" @@ -33918,7 +33918,7 @@ ], "example": "string or id" }, - "user2": { + "conversation": { "oneOf": [ { "type": "integer" @@ -34000,7 +34000,7 @@ "fileUrl": { "type": "string" }, - "user1": { + "author": { "type": "object", "properties": { "id": { @@ -36532,7 +36532,7 @@ } } }, - "user2": { + "conversation": { "type": "object", "properties": { "id": { @@ -36540,6 +36540,172 @@ }, "documentId": { "type": "string" + }, + "user1": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + } + } + }, + "user2": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + } + } + }, + "direct_messages": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + }, + "content": { + "type": "string" + }, + "fileUrl": { + "type": "string" + }, + "author": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + } + } + }, + "conversation": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "publishedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + } + } + }, + "locale": { + "type": "string" + }, + "localizations": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + } + } + } + } + } + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "publishedAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + } + } + }, + "updatedBy": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + } + } + }, + "locale": { + "type": "string" + }, + "localizations": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "documentId": { + "type": "string" + } + } + } } } }, @@ -36590,85 +36756,6 @@ }, "documentId": { "type": "string" - }, - "content": { - "type": "string" - }, - "fileUrl": { - "type": "string" - }, - "user1": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "documentId": { - "type": "string" - } - } - }, - "user2": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "documentId": { - "type": "string" - } - } - }, - "createdAt": { - "type": "string", - "format": "date-time" - }, - "updatedAt": { - "type": "string", - "format": "date-time" - }, - "publishedAt": { - "type": "string", - "format": "date-time" - }, - "createdBy": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "documentId": { - "type": "string" - } - } - }, - "updatedBy": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "documentId": { - "type": "string" - } - } - }, - "locale": { - "type": "string" - }, - "localizations": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "documentId": { - "type": "string" - } - } - } } } } diff --git a/types/generated/contentTypes.d.ts b/types/generated/contentTypes.d.ts index cf08a2e..5803343 100644 --- a/types/generated/contentTypes.d.ts +++ b/types/generated/contentTypes.d.ts @@ -682,6 +682,7 @@ export interface ApiConversationConversation extends Struct.CollectionTypeSchema { collectionName: 'conversations'; info: { + description: ''; displayName: 'Conversation'; pluralName: 'conversations'; singularName: 'conversation'; @@ -722,6 +723,7 @@ export interface ApiDirectMessageDirectMessage extends Struct.CollectionTypeSchema { collectionName: 'direct_messages'; info: { + description: ''; displayName: 'DirectMessage'; pluralName: 'direct-messages'; singularName: 'direct-message'; @@ -730,7 +732,15 @@ export interface ApiDirectMessageDirectMessage draftAndPublish: false; }; attributes: { + author: Schema.Attribute.Relation< + 'oneToOne', + 'plugin::users-permissions.user' + >; content: Schema.Attribute.String; + conversation: Schema.Attribute.Relation< + 'manyToOne', + 'api::conversation.conversation' + >; createdAt: Schema.Attribute.DateTime; createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; @@ -745,14 +755,6 @@ export interface ApiDirectMessageDirectMessage updatedAt: Schema.Attribute.DateTime; updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private; - user1: Schema.Attribute.Relation< - 'oneToOne', - 'plugin::users-permissions.user' - >; - user2: Schema.Attribute.Relation< - 'oneToOne', - 'plugin::users-permissions.user' - >; }; }