move api/server to api/edge/bff
This commit is contained in:
24
api/edge/bff/internal/server/invitationimp/decline.go
Normal file
24
api/edge/bff/internal/server/invitationimp/decline.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package invitationimp
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/tech/sendico/pkg/api/http/response"
|
||||
"github.com/tech/sendico/pkg/mutil/mzap"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func (a *InvitationAPI) decline(r *http.Request) http.HandlerFunc {
|
||||
invitationRef, err := a.irh.GetRef(r)
|
||||
if err != nil {
|
||||
return a.respondBadReference(r, err)
|
||||
}
|
||||
|
||||
ctx := r.Context()
|
||||
if err := a.db.Decline(ctx, invitationRef); err != nil {
|
||||
a.Logger.Warn("Failed to decline invitation", zap.Error(err), mzap.ObjRef("invitation_ref", invitationRef))
|
||||
return response.Auto(a.Logger, a.Name(), err)
|
||||
}
|
||||
|
||||
return response.Success(a.Logger)
|
||||
}
|
||||
Reference in New Issue
Block a user