Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correction webhook eventhandler #815

Merged
merged 9 commits into from
Dec 27, 2024
Merged

Correction webhook eventhandler #815

merged 9 commits into from
Dec 27, 2024

Conversation

Hueter57
Copy link
Contributor

@Hueter57 Hueter57 commented Dec 6, 2024

#769

TransactionTransactionNewCreateTransactionCorrectionに分離

webhook.goも構造体を分け、POSTとPUTで処理を分けた

Copy link

codecov bot commented Dec 6, 2024

Codecov Report

Attention: Patch coverage is 0% with 115 lines in your changes missing coverage. Please review.

Project coverage is 25.22%. Comparing base (7a76319) to head (a040a41).
Report is 22 commits behind head on v2.

Files with missing lines Patch % Lines
service/webhook.go 0.00% 107 Missing ⚠️
router/router.go 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               v2     #815      +/-   ##
==========================================
- Coverage   25.25%   25.22%   -0.03%     
==========================================
  Files         147      147              
  Lines       30735    30752      +17     
==========================================
- Hits         7761     7757       -4     
- Misses      22088    22109      +21     
  Partials      886      886              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Hueter57 Hueter57 requested a review from H1rono December 6, 2024 15:26
Copy link
Member

@H1rono H1rono left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

とりあえず

router/transaction.go Outdated Show resolved Hide resolved
service/webhook.go Outdated Show resolved Hide resolved
service/webhook.go Outdated Show resolved Hide resolved
@Hueter57 Hueter57 requested a review from H1rono December 6, 2024 15:56
Copy link
Member

@H1rono H1rono left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

service/webhook.go Outdated Show resolved Hide resolved
@Hueter57 Hueter57 requested a review from H1rono December 9, 2024 11:09
Copy link
Member

@H1rono H1rono left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

とりあえずこれだけ

service/webhook.go Outdated Show resolved Hide resolved
Comment on lines 102 to 103
if err != nil {
return ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここlog残したいな(後でissueにする)

service/webhook.go Outdated Show resolved Hide resolved
@Hueter57 Hueter57 requested a review from H1rono December 13, 2024 09:20
Copy link
Member

@H1rono H1rono left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

よく分けられてます

/api/requests以下と/api/transactions以下でmiddleware.BodyDumpに渡す関数を分けたら嬉しそうだなと思ったんですが、お願いできますか?

/requests以下はWebhookEventHandlerを経由してWebhookRequestsEventHandlerを呼び出すのではなくWebhookRequestsEventHandlerを直接渡して、

Jomon/router/router.go

Lines 49 to 67 in 0f91889

apiRequests := api.Group("/requests", h.CheckLoginMiddleware)
{
apiRequests.GET("", h.GetRequests)
apiRequests.POST("", h.PostRequest, middleware.BodyDump(service.WebhookEventHandler))
apiRequestIDs := apiRequests.Group("/:requestID", retrieveRequestCreator)
{
apiRequestIDs.GET("", h.GetRequest)
apiRequestIDs.PUT(
"",
h.PutRequest,
middleware.BodyDump(service.WebhookEventHandler),
h.CheckRequestCreatorMiddleware)
apiRequestIDs.POST(
"/comments",
h.PostComment,
middleware.BodyDump(service.WebhookEventHandler))
apiRequestIDs.PUT("/status", h.PutStatus, h.CheckAdminOrRequestCreatorMiddleware)
}
}

/api/transactions以下も同様にWebhookTransactionsEventHandlerを直接渡す形を想定してます

Jomon/router/router.go

Lines 69 to 83 in 0f91889

apiTransactions := api.Group("/transactions", h.CheckLoginMiddleware)
{
apiTransactions.GET("", h.GetTransactions)
apiTransactions.POST(
"",
h.PostTransaction,
middleware.BodyDump(service.WebhookEventHandler),
h.CheckAdminMiddleware)
apiTransactions.GET("/:transactionID", h.GetTransaction)
apiTransactions.PUT(
"/:transactionID",
h.PutTransaction,
middleware.BodyDump(service.WebhookEventHandler),
h.CheckAdminMiddleware)
}

router/transaction.go Outdated Show resolved Hide resolved
@Hueter57 Hueter57 requested a review from H1rono December 26, 2024 08:54
Copy link
Member

@H1rono H1rono left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@H1rono H1rono mentioned this pull request Dec 26, 2024
@H1rono H1rono merged commit c3dbb3b into v2 Dec 27, 2024
5 of 7 checks passed
@H1rono H1rono deleted the correction_webhook_eventhandler branch December 27, 2024 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants