add endpoint for delete

This commit is contained in:
Cubicroot 2021-06-06 19:30:25 +02:00
parent 3834e90527
commit b392ea1b44
6 changed files with 65 additions and 34 deletions

View file

@ -20,6 +20,17 @@ func getID(ctx *gin.Context) (uint, error) {
return id, nil
}
func getMessageID(ctx *gin.Context) (string, error) {
id, ok := ctx.MustGet("messageid").(string)
if !ok {
err := errors.New("an error occured while retrieving messageID from context")
ctx.AbortWithError(http.StatusInternalServerError, err)
return "", err
}
return id, nil
}
func getApplication(ctx *gin.Context, db Database) (*model.Application, error) {
id, err := getID(ctx)
if err != nil {