From 0c704b80a99ac753c40bbc2522ae7bce102bcaff Mon Sep 17 00:00:00 2001 From: trunglt251292 Date: Fri, 3 Jun 2022 13:53:17 +0700 Subject: [PATCH 1/3] [Update] add new func --- constants.go | 2 ++ request.go | 5 +++++ struct.go | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/constants.go b/constants.go index eefc318..05abcfe 100644 --- a/constants.go +++ b/constants.go @@ -10,4 +10,6 @@ const ( SubjectRequestNatsAddLogs = "authentication.request.logs.create" SubjectRequestNatsLogsGetList = "authentication.request.logs.list" + + SubjectRequestNatsGetTokenWithPhone = "authentication.request.staff.get_token" ) diff --git a/request.go b/request.go index 1bddcf1..f22a5f2 100644 --- a/request.go +++ b/request.go @@ -38,3 +38,8 @@ func (Request) SaveLog(payload Log) (*Response, error) { func (Request) GetListLogs(payload *CommonQuery) (*Response, error) { return requestNats(SubjectRequestNatsLogsGetList, toBytes(payload)) } + +// GetTokenWithPhoneNumber ... +func (Request) GetTokenWithPhoneNumber(payload *GetTokenByPhoneBody) (*Response, error) { + return requestNats(SubjectRequestNatsGetTokenWithPhone, toBytes(payload)) +} diff --git a/struct.go b/struct.go index d5e5c4a..e1a6e6f 100644 --- a/struct.go +++ b/struct.go @@ -14,6 +14,11 @@ type CommonQuery struct { StaffID string `json:"staffID"` } +// GetTokenByPhoneBody ... +type GetTokenByPhoneBody struct { + Phone string `json:"phone"` +} + // Log ... type Log struct { Reference string `json:"reference"` -- 2.34.1 From 620df101aaf8c074b13403a5c3ea3b88ef8d4a67 Mon Sep 17 00:00:00 2001 From: trunglt251292 Date: Fri, 3 Jun 2022 13:56:32 +0700 Subject: [PATCH 2/3] [Update] add new func --- struct.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/struct.go b/struct.go index e1a6e6f..5fc53fd 100644 --- a/struct.go +++ b/struct.go @@ -19,6 +19,11 @@ type GetTokenByPhoneBody struct { Phone string `json:"phone"` } +// GetTokenByPhoneResponse ... +type GetTokenByPhoneResponse struct { + Token string `json:"token"` +} + // Log ... type Log struct { Reference string `json:"reference"` -- 2.34.1 From e6512d770c8e020e9ced81291dddd7bc1881b863 Mon Sep 17 00:00:00 2001 From: trunglt251292 Date: Tue, 14 Jun 2022 14:31:02 +0700 Subject: [PATCH 3/3] [Update] Check permission --- struct.go | 1 + 1 file changed, 1 insertion(+) diff --git a/struct.go b/struct.go index d5e5c4a..5e394e6 100644 --- a/struct.go +++ b/struct.go @@ -84,6 +84,7 @@ type PayloadCheckPermission struct { type StaffCheckPermissionResponse struct { Message string `json:"message"` IsValid bool `json:"isValid"` + Code int `json:"code"` } // StaffGetPermissions ... -- 2.34.1