-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #264 from daniloab/feat/openapi-channels
feat(openapi): add support for channels
- Loading branch information
Showing
10 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
info: { | ||
title: 'User Event API', | ||
version: '1.0.0', | ||
}, | ||
description: ' User Event API Specification', | ||
openapi: '3.0.0', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"info": { | ||
"title": "User Event API", | ||
"version": "1.0.0" | ||
}, | ||
"description": "User Event API Specification", | ||
"openapi": "3.0.0", | ||
"paths": {}, | ||
"components": { | ||
"messages": { | ||
"UserSignedIn": { | ||
"payload": { | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "string", | ||
"description": "Id of the user" | ||
} | ||
} | ||
} | ||
}, | ||
"UserSignedUp": { | ||
"payload": { | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "string", | ||
"description": "Id of the user" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"channels": { | ||
"user/signedin": { | ||
"subscribe": { | ||
"message": { | ||
"$ref": "#/components/messages/UserSignedIn" | ||
} | ||
} | ||
}, | ||
"user/signedup": { | ||
"subscribe": { | ||
"message": { | ||
"$ref": "#/components/messages/UserSignedUp" | ||
} | ||
} | ||
} | ||
}, | ||
"tags": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
info: | ||
title: User Event API | ||
version: 1.0.0 | ||
description: 'User Event API Specification' | ||
openapi: 3.0.0 | ||
paths: {} | ||
components: | ||
messages: | ||
UserSignedIn: | ||
payload: | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
description: Id of the user | ||
UserSignedUp: | ||
payload: | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
description: Id of the user | ||
channels: | ||
user/signedin: | ||
subscribe: | ||
message: | ||
$ref: '#/components/messages/UserSignedIn' | ||
user/signedup: | ||
subscribe: | ||
message: | ||
$ref: '#/components/messages/UserSignedUp' | ||
tags: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// ou usersignin event it will be placed here | ||
export const userSignIn = (job: Job<{ userId: string }>) => { | ||
const { userId } = job.data; | ||
|
||
console.log("User Logged", userId); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
channels: | ||
user/signedin: | ||
subscribe: | ||
message: | ||
$ref: '#/components/messages/UserSignedIn' | ||
components: | ||
messages: | ||
UserSignedIn: | ||
payload: | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
description: Id of the user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const userSignUp = (job: Job<{ userId: string }>) => { | ||
const { userId } = job.data; | ||
|
||
console.log("User Registered", userId); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
channels: | ||
user/signedup: | ||
subscribe: | ||
message: | ||
$ref: '#/components/messages/UserSignedUp' | ||
components: | ||
messages: | ||
UserSignedUp: | ||
payload: | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
description: Id of the user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters