feat: invite management API: DELETE /v1/user/invite/:id (204, cancels a pending invite) and POST /v1/user/invite/:id/renew (200, new code, expires_at = now+3d, created_at = now, resends the invitation email, old link dead)
This commit is contained in:
1 parent
461e93e3b5
commit
153fd8719a
18 files changed
+1147
-44
No files matched your search
@@ -0,0 +1,18 @@
|
||||
package useCases
|
||||
|
||||
import "RenewCMS/internal/domain/invite"
|
||||
|
||||
type CancelInviteUseCase struct {
|
||||
inviteRepository invite.Repository
|
||||
}
|
||||
|
||||
func NewCancelInviteUseCase(inviteRepository invite.Repository) *CancelInviteUseCase {
|
||||
return &CancelInviteUseCase{inviteRepository}
|
||||
}
|
||||
|
||||
func (c *CancelInviteUseCase) CancelInvite(id uint32) error {
|
||||
if _, err := findManageableInvite(c.inviteRepository, id); err != nil {
|
||||
return err
|
||||
}
|
||||
return c.inviteRepository.Delete(id)
|
||||
}
|
||||
Reference in new issue
Block a user