mirror of
https://github.com/pushbits/server.git
synced 2025-06-09 14:12:15 +02:00
Register application after adding it to database
This commit is contained in:
parent
eb4af43041
commit
3971316cc9
1 changed files with 9 additions and 3 deletions
|
@ -44,12 +44,18 @@ func (h *ApplicationHandler) createApplication(ctx *gin.Context, name string, u
|
|||
application.Token = authentication.GenerateNotExistingToken(authentication.GenerateApplicationToken, h.applicationExists)
|
||||
application.UserID = u.ID
|
||||
|
||||
if err := h.registerApplication(ctx, &application, u); err != nil {
|
||||
err := h.DB.CreateApplication(&application)
|
||||
if success := successOrAbort(ctx, http.StatusInternalServerError, err); !success {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err := h.DB.CreateApplication(&application)
|
||||
if success := successOrAbort(ctx, http.StatusInternalServerError, err); !success {
|
||||
if err := h.registerApplication(ctx, &application, u); err != nil {
|
||||
err := h.DB.DeleteApplication(&application)
|
||||
|
||||
if success := successOrAbort(ctx, http.StatusInternalServerError, err); !success {
|
||||
log.Printf("Cannot delete application with ID %d.\n", application.ID)
|
||||
}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue