diff --git a/src/schema/events/discussion/message.json b/src/schema/events/discussion/message.json new file mode 100644 index 00000000..4732597b --- /dev/null +++ b/src/schema/events/discussion/message.json @@ -0,0 +1,24 @@ +{ + "discussion_message": { + "create": { + "type": "object", + "properties": { + "id": { + "type": "number" + } + }, + "required": ["id"], + "additionalProperties": false + }, + "update": { + "type": "object", + "properties": { + "id": { + "type": "number" + } + }, + "required": ["id"], + "additionalProperties": false + } + } +} diff --git a/src/schema/events/discussion/room.json b/src/schema/events/discussion/room.json new file mode 100644 index 00000000..a6d60927 --- /dev/null +++ b/src/schema/events/discussion/room.json @@ -0,0 +1,64 @@ +{ + "discussion_room": { + "create": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "folderId": { + "type": "number" + }, + "roomTypeId": { + "type": "number" + }, + "memberIds": { + "type": "array", + "items": { + "type": "number" + } + } + }, + "required": ["id", "folderId", "roomTypeId"], + "additionalProperties": false + }, + "update": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "folderId": { + "type": "number" + }, + "roomTypeId": { + "type": "number" + }, + "memberIds": { + "type": "array", + "items": { + "type": "number" + } + } + }, + "required": ["id", "folderId", "roomTypeId", "memberIds"], + "additionalProperties": false + }, + "delete": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "folderId": { + "type": "number" + }, + "roomTypeId": { + "type": "number" + } + }, + "required": ["id", "folderId", "roomTypeId"], + "additionalProperties": false + } + } +} diff --git a/src/schema/events/index.ts b/src/schema/events/index.ts index 4e3a81ea..a96164f4 100644 --- a/src/schema/events/index.ts +++ b/src/schema/events/index.ts @@ -7,3 +7,6 @@ export { adminMessage } from "./adminMessage.json"; export { thirdParty } from "./thirdParty.json"; export { accountingEntryLettering } from "./accountingEntryLettering.json"; export { cloudDocument } from "./cloudDocument.json"; + +export { discussion_room } from "./discussion/room.json"; +export { discussion_message } from "./discussion/message.json"; diff --git a/src/types/events.ts b/src/types/events.ts index 566bc5a9..a9144671 100644 --- a/src/types/events.ts +++ b/src/types/events.ts @@ -123,6 +123,42 @@ export interface CloudDocument { } } +export type PushNotificationScope = Scope & { + persPhysiqueId: number; + accountingFolderId: number; +}; + +export type DiscussionRoomOperation = Operation[ + keyof Pick +]; + + +export type DiscussionRoomScope = PushNotificationScope; + +export interface DiscussionRoom { + name: "discussion_room"; + scope: DiscussionRoomScope; + operation: T; + data: (T extends Operation[keyof Pick] ? { + memberIds: number[]; + } : unknown) & { + id: number; + folderId: number; + roomTypeId: number; + }; +} + +export type DiscussionMessageScope = PushNotificationScope; + +export interface DiscussionMessage { + name: "discussion_message"; + scope: DiscussionMessageScope; + operation: "CREATE" | "UPDATE"; + data: { + id: number; + } +} + export interface Events { accountingFolder: AccountingFolder; connector: Connector; @@ -133,4 +169,6 @@ export interface Events { thirdParty: ThirdParty; accountingEntryLettering: AccountingEntryLettering; cloudDocument: CloudDocument; + discussionRoom: DiscussionRoom; + discussionMessage: DiscussionMessage; }