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,16 @@
|
||||
package useCases
|
||||
|
||||
import "RenewCMS/internal/domain/invite"
|
||||
|
||||
func findManageableInvite(inviteRepository invite.Repository, id uint32) (invite.Invite, error) {
|
||||
for _, existing := range inviteRepository.GetAll() {
|
||||
if existing.ID != id {
|
||||
continue
|
||||
}
|
||||
if existing.AcceptedAt != nil {
|
||||
return invite.Invite{}, invite.ErrInviteAlreadyAccepted
|
||||
}
|
||||
return existing, nil
|
||||
}
|
||||
return invite.Invite{}, invite.ErrInviteNotFound
|
||||
}
|
||||
Reference in new issue
Block a user