Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
24 changes: 24 additions & 0 deletions src/schema/events/discussion/message.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}
64 changes: 64 additions & 0 deletions src/schema/events/discussion/room.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}
3 changes: 3 additions & 0 deletions src/schema/events/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
38 changes: 38 additions & 0 deletions src/types/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,42 @@ export interface CloudDocument {
}
}

export type PushNotificationScope = Scope & {
persPhysiqueId: number;
accountingFolderId: number;
};

export type DiscussionRoomOperation = Operation[
keyof Pick<Operation, "create" | "update" | "delete">
];


export type DiscussionRoomScope = PushNotificationScope;

export interface DiscussionRoom<T extends DiscussionRoomOperation = DiscussionRoomOperation> {
name: "discussion_room";
scope: DiscussionRoomScope;
operation: T;
data: (T extends Operation[keyof Pick<Operation, "create" | "update">] ? {
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;
Expand All @@ -133,4 +169,6 @@ export interface Events {
thirdParty: ThirdParty;
accountingEntryLettering: AccountingEntryLettering;
cloudDocument: CloudDocument;
discussionRoom: DiscussionRoom;
discussionMessage: DiscussionMessage;
}