-
Notifications
You must be signed in to change notification settings - Fork 0
Feat: invite #135
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
Feat: invite #135
Conversation
}) | ||
|
||
if len((projectIDs)) > 0 { | ||
projects, err := api.projectService.Find(ctx, project.ProjectFilter{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double (( and ))
}) | ||
return | ||
} | ||
if len(projects) != len((projectIDs)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double (( and ))
if publicID == "" { | ||
reqCtx.AbortWithStatusJSON(http.StatusBadRequest, responses.ErrorResponse{ | ||
Code: "5cbdb58e-6228-4d9a-9893-7f744608a9e8", | ||
Error: "missing project public ID", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's invite public id
if err != nil || inviteEntity == nil { | ||
reqCtx.AbortWithStatusJSON(http.StatusNotFound, responses.ErrorResponse{ | ||
Code: "121ef112-cb39-4235-9500-b116adb69984", | ||
Error: "proj not found", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and invite not found too
} | ||
|
||
func (s *InviteService) SendInviteEmail(ctx context.Context, e EmailMetadata, to string) error { | ||
templateString := `<html><body><div style="font-family: Arial, sans-serif; max-width: 600px; margin: auto; border: 1px solid #ddd; border-radius: 8px; overflow: hidden;"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we move it to template file some where.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should move it when we have the second template. (next time)
...-api-gateway/application/app/interfaces/http/routes/v1/organization/invites/invites_route.go
Show resolved
Hide resolved
|
||
err := api.inviteService.DeleteInviteByID(ctx, inviteEntity.ID) | ||
if err != nil { | ||
reqCtx.JSON(http.StatusNotFound, responses.ErrorResponse{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be error as the not found should from auth.GetAdminInviteFromContext(reqCtx)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's likely an internal server error because auth.GetAdminInviteFromContext(reqCtx)
will return "not found".
headers += "MIME-Version: 1.0\r\n" | ||
headers += "Content-Type: text/html; charset=\"UTF-8\"\r\n" | ||
headers += "From: " + envs.SMTP_SENDER_EMAIL + "\r\n" | ||
headers += "To: " + to + "\r\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we support multiple emails sending or email validation here. It may dangerous without mail address validation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Email validation (with allow/block lists and spam detection) is too difficult to handle at this moment.
If we support sending multiple emails, we will introduce a message queue and a task dispatcher to handle it offline. This is overkill at the moment.
(Another excuse to implement it next time)
Almost are minor comment. |
pls resolve the conflict and feel free to merge |
Implement endpoint for /invites