From 2874a559ad34f1ea647ab631cb23d9b6f360f4db Mon Sep 17 00:00:00 2001 From: Aldino Kemal Date: Tue, 29 Oct 2024 21:36:53 +0700 Subject: [PATCH] chore(settings.go): bump AppVersion to v4.21.0 for new release feat(message.go): add logging for MarkAsRead function using logrus for better traceability fix(GroupManageParticipants.js): remove redundant '@' from group_id computation --- docs/openapi.yaml | 46 ++++++++++++++++++- readme.md | 3 +- src/config/settings.go | 2 +- src/services/message.go | 8 ++++ .../components/GroupManageParticipants.js | 2 +- 5 files changed, 57 insertions(+), 4 deletions(-) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 71569f6..c278281 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: title: WhatsApp API MultiDevice - version: 4.3.0 + version: 4.4.0 description: This API is used for sending whatsapp via API servers: - url: http://localhost:3000 @@ -835,6 +835,50 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorInternalServer' + /message/{message_id}/read: + post: + operationId: readMessage + tags: + - message + summary: Mark as read message + parameters: + - in: path + name: message_id + schema: + type: string + required: true + description: Message ID + requestBody: + content: + application/json: + schema: + type: object + properties: + phone: + type: string + example: '62819273192397132@s.whatsapp.net' + description: Phone number with country code + required: + - phone + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SendResponse' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorBadRequest' + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorInternalServer' /group: post: operationId: createGroup diff --git a/readme.md b/readme.md index a27272a..4052b5c 100644 --- a/readme.md +++ b/readme.md @@ -128,6 +128,7 @@ You can fork or edit this source code ! | ✅ | React Message | POST | /message/:message_id/reaction | | ✅ | Delete Message | POST | /message/:message_id/delete | | ✅ | Edit Message | POST | /message/:message_id/update | +| ✅ | Read Message (DM) | POST | /message/:message_id/read | | ❌ | Star message | POST | /message/:message_id/star | | ✅ | Join Group With Link | POST | /group/join-with-link | | ✅ | Leave Group | POST | /group/leave | @@ -136,7 +137,7 @@ You can fork or edit this source code ! | ✅ | Remove Participant in Group | POST | /group/participants/remove | | ✅ | Promote Participant in Group | POST | /group/participants/promote | | ✅ | Demote Participant in Group | POST | /group/participants/demote | -| ✅ | Unfollow Newsletter | POST | /newsletter/unfollow | +| ✅ | Unfollow Newsletter | POST | /newsletter/unfollow | ``` ✅ = Available diff --git a/src/config/settings.go b/src/config/settings.go index 9747fa2..e09c303 100644 --- a/src/config/settings.go +++ b/src/config/settings.go @@ -5,7 +5,7 @@ import ( ) var ( - AppVersion = "v4.20.0" + AppVersion = "v4.21.0" AppPort = "3000" AppDebug = false AppOs = "AldinoKemal" diff --git a/src/services/message.go b/src/services/message.go index 89bef11..2e40aa0 100644 --- a/src/services/message.go +++ b/src/services/message.go @@ -7,6 +7,7 @@ import ( domainMessage "github.com/aldinokemal/go-whatsapp-web-multidevice/domains/message" "github.com/aldinokemal/go-whatsapp-web-multidevice/pkg/whatsapp" "github.com/aldinokemal/go-whatsapp-web-multidevice/validations" + "github.com/sirupsen/logrus" "go.mau.fi/whatsmeow" "go.mau.fi/whatsmeow/appstate" "go.mau.fi/whatsmeow/proto/waCommon" @@ -41,6 +42,13 @@ func (service serviceMessage) MarkAsRead(ctx context.Context, request domainMess return response, err } + logrus.Info(map[string]interface{}{ + "phone": request.Phone, + "message_id": request.MessageID, + "chat": dataWaRecipient.String(), + "sender": service.WaCli.Store.ID.String(), + }) + response.MessageID = request.MessageID response.Status = fmt.Sprintf("Mark as read success %s", request.MessageID) return response, nil diff --git a/src/views/components/GroupManageParticipants.js b/src/views/components/GroupManageParticipants.js index 914114b..3c49ff9 100644 --- a/src/views/components/GroupManageParticipants.js +++ b/src/views/components/GroupManageParticipants.js @@ -10,7 +10,7 @@ export default { }, computed: { group_id() { - return `${this.group}@${window.TYPEGROUP}`; + return `${this.group}${window.TYPEGROUP}`; }, }, methods: {