Skip to content

Commit

Permalink
update all attributes in mailgun credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mattia-m committed Nov 23, 2023
1 parent a972db0 commit 8456436
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
18 changes: 9 additions & 9 deletions internal/dao/credentials_mailgun.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ func (dc *DaoClient) CreateMailgunCredential(credentials model.MailgunCredential
}

return &model.MailgunCredentialsResponse{
Id: searchedCredentials.Id,
ProjectId: searchedCredentials.ProjectId,
Domain: searchedCredentials.Domain,
ApiBase: searchedCredentials.ApiBase,
SenderEmail: searchedCredentials.SenderEmail,
SenderName: searchedCredentials.SenderName,
ReplyToEmail: searchedCredentials.ReplyToEmail,
CreatedAt: searchedCredentials.CreatedAt,
UpdatedAt: searchedCredentials.UpdatedAt,
Id: responseCredentials.Id,
ProjectId: responseCredentials.ProjectId,
Domain: responseCredentials.Domain,
ApiBase: responseCredentials.ApiBase,
SenderEmail: responseCredentials.SenderEmail,
SenderName: responseCredentials.SenderName,
ReplyToEmail: responseCredentials.ReplyToEmail,
CreatedAt: responseCredentials.CreatedAt,
UpdatedAt: responseCredentials.UpdatedAt,
}, nil
}

Expand Down
24 changes: 14 additions & 10 deletions internal/service/domain_credentials_mailgun.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ func (c *Client) CreateMailgunCredentials(projectId string, credentialsRequest m
}

credentials := model.MailgunCredentials{
ProjectId: projectId,
Domain: credentialsRequest.Domain,
ApiKey: credentialsRequest.ApiKey,
SenderEmail: credentialsRequest.SenderEmail,
SenderName: credentialsRequest.SenderName,
ProjectId: projectId,
Domain: credentialsRequest.Domain,
ApiKey: credentialsRequest.ApiKey,
ApiBase: credentialsRequest.ApiBase,
SenderEmail: credentialsRequest.SenderEmail,
SenderName: credentialsRequest.SenderName,
ReplyToEmail: credentialsRequest.ReplyToEmail,
}

createdCredentials, err := c.db.CreateMailgunCredential(credentials)
Expand All @@ -47,11 +49,13 @@ func (c *Client) UpdateMailgunCredentials(projectId string, credentialsRequest m
}

credentials := model.MailgunCredentials{
ProjectId: projectId,
Domain: credentialsRequest.Domain,
ApiKey: credentialsRequest.ApiKey,
SenderEmail: credentialsRequest.SenderEmail,
SenderName: credentialsRequest.SenderName,
ProjectId: projectId,
Domain: credentialsRequest.Domain,
ApiKey: credentialsRequest.ApiKey,
ApiBase: credentialsRequest.ApiBase,
SenderEmail: credentialsRequest.SenderEmail,
SenderName: credentialsRequest.SenderName,
ReplyToEmail: credentialsRequest.ReplyToEmail,
}

updatedCredentials, err := c.db.UpdateMailgunCredential(credentials)
Expand Down

0 comments on commit 8456436

Please sign in to comment.