Skip to content

Commit

Permalink
doc(): enhanced events with operation type (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rossb0b authored Aug 1, 2023
1 parent 7e78a73 commit ebac860
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
43 changes: 40 additions & 3 deletions docs/events.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
```ts
export interface Operation {
create: "CREATE";
update: "UPDATE";
delete: "DELETE";
void: "VOID";
}
```

# Connector

Event notifying the modification of a partner integration.
Expand All @@ -6,9 +15,13 @@ Event notifying the modification of a partner integration.
- [JSON Schema](./json-schema/events/connector.md)

```ts
export type ConnectorOperation = Operation[
keyof Omit<Operation, "void">
];

export interface Connector {
name: "connector";
operation: "CREATE" | "UPDATE" | "DELETE";
operation: ConnectorOperation;
data: {
id: string;
code: string;
Expand All @@ -25,9 +38,13 @@ Event notifying the creation of a new Accounting Folder (a company).
- [JSON Schema](./json-schema/events/accountingFolder.md)

```ts
export type AccountingFolderOperation = Operation[
keyof Pick<Operation, "create">
];

export interface AccountingFolder {
name: "accountingFolder";
operation: "CREATE";
operation: AccountingFolderOperation;
data: {
id: string;
};
Expand All @@ -42,6 +59,10 @@ Event notifying the creation/addition of a document.
- [JSON Schema](./json-schema/events/document.md)

```ts
export type DocumentOperation = Operation[
keyof Pick<Operation, "create">
];

export enum DocumentKind {
DossierAnnuel = "AF",
DossierPermanent = "PF",
Expand All @@ -51,7 +72,7 @@ export enum DocumentKind {

export interface Document {
name: "document";
operation: "CREATE";
operation: DocumentOperation;
data: {
id: string;
kind: DocumentKind;
Expand All @@ -67,6 +88,10 @@ Event notifying the creation or deletion of an Accounting Portfolio (or Accounti
- [JSON Schema](./json-schema/events/portfolio.md)

```ts
export type PortfolioOperation = Operation[
keyof Omit<Operation, "update" | "void">
];

export interface Portfolio {
name: "portfolio";
operation: PortfolioOperation;
Expand All @@ -82,6 +107,10 @@ export interface Portfolio {
- [JSON Schema](./json-schema/events/accountingLineEntry.md)

```ts
export type AccountingLineEntryOperation = Operation[
keyof Pick<Operation, "create">
];

export interface AccountingLineEntry {
name: "accountingLineEntry";
operation: AccountingLineEntryOperation;
Expand All @@ -97,6 +126,10 @@ export interface AccountingLineEntry {
- [JSON Schema](./json-schema/events/adminMessage.md)

```ts
export type AdminMessageOperation = Operation[
keyof Pick<Operation, "void">
];

export interface AdminMessage {
name: "adminMessage";
operation: AdminMessageOperation;
Expand All @@ -118,6 +151,10 @@ export interface AdminMessage {
- [JSON Schema](./json-schema/events/thirdParty.md)

```ts
export type ThirdPartyOperation = Operation[
keyof Omit<Operation, "void">
]

export interface ThirdParty {
name: "thirdParty";
operation: ThirdPartyOperation;
Expand Down
2 changes: 1 addition & 1 deletion src/types/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export interface AccountingLineEntry {

export type AdminMessageOperation = Operation[
keyof Pick<Operation, "void">
]
];

export interface AdminMessage {
name: "adminMessage";
Expand Down

0 comments on commit ebac860

Please sign in to comment.