Skip to content

Commit

Permalink
feat(./types/event): ts & schema for discussion events
Browse files Browse the repository at this point in the history
  • Loading branch information
Rossb0b committed Aug 22, 2024
1 parent a6bacb1 commit 9cf12b1
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 2 deletions.
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
}
}
}
34 changes: 34 additions & 0 deletions src/schema/events/discussion/room.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"discussion_room": {
"create": {
"type": "object",
"properties": {
"id": {
"type": "number"
}
},
"required": ["id"],
"additionalProperties": false
},
"update": {
"type": "object",
"properties": {
"id": {
"type": "number"
}
},
"required": ["id"],
"additionalProperties": false
},
"delete": {
"type": "object",
"properties": {
"id": {
"type": "number"
}
},
"required": ["id"],
"additionalProperties": false
}
}
}
24 changes: 24 additions & 0 deletions src/schema/events/discussion/unreadMessage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"discussion_unread_message": {
"create": {
"type": "object",
"properties": {
"id": {
"type": "number"
}
},
"required": ["id"],
"additionalProperties": false
},
"update": {
"type": "object",
"properties": {
"id": {
"type": "number"
}
},
"required": ["id"],
"additionalProperties": false
}
}
}
4 changes: 4 additions & 0 deletions src/schema/events/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ 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";
export { discussion_unread_message } from "./discussion/unreadMessage.json";
37 changes: 35 additions & 2 deletions src/types/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,45 @@ export type DiscussionRoomOperation = Operation[

export type DiscussionRoomScope = PushNotificationScope;

export interface discussionRoom {
name: "room";
export interface DiscussionRoom {
name: "discussion_room";
scope: DiscussionRoomScope;
operation: DiscussionRoomOperation;
data: {
id: number;
}
}

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

export type DiscussionMessageScope = PushNotificationScope;

export interface DiscussionMessage {
name: "discussion_message";
scope: DiscussionMessageScope;
operation: DiscussionMessageOperation;
data: {
id: number;
}
}

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

export type DiscussionUnreadMessageScope = PushNotificationScope;

export interface DiscussionUnreadMessage {
name: "discussion_unread_message";
scope: DiscussionUnreadMessageScope;
operation: DiscussionUnreadMessageOperation;
data: {
id: number;
}
}

export interface Events {
accountingFolder: AccountingFolder;
connector: Connector;
Expand All @@ -152,4 +182,7 @@ export interface Events {
thirdParty: ThirdParty;
accountingEntryLettering: AccountingEntryLettering;
cloudDocument: CloudDocument;
discussionRoom: DiscussionRoom;
discussionMessage: DiscussionMessage;
discussionUnreadMessage: DiscussionUnreadMessage;
}

0 comments on commit 9cf12b1

Please sign in to comment.