wip
This commit is contained in:
@@ -33,7 +33,7 @@ func (mc *MembershipController) RegisterSubscription(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
var subscription models.SubscriptionModel
|
||||
var subscription models.Subscription
|
||||
if err := c.ShouldBindJSON(&subscription); err != nil {
|
||||
utils.HandleValidationError(c, err)
|
||||
return
|
||||
@@ -43,9 +43,9 @@ func (mc *MembershipController) RegisterSubscription(c *gin.Context) {
|
||||
id, err := mc.Service.RegisterSubscription(&subscription)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "UNIQUE constraint failed") {
|
||||
utils.RespondWithError(c, err, "Subscription already exists", http.StatusConflict, errors.Responses.Fields.SubscriptionModel, errors.Responses.Keys.Duplicate)
|
||||
utils.RespondWithError(c, err, "Subscription already exists", http.StatusConflict, errors.Responses.Fields.Subscription, errors.Responses.Keys.Duplicate)
|
||||
} else {
|
||||
utils.RespondWithError(c, err, "Couldn't register Membershipmodel", http.StatusInternalServerError, errors.Responses.Fields.SubscriptionModel, errors.Responses.Keys.InternalServerError)
|
||||
utils.RespondWithError(c, err, "Couldn't register Membershipmodel", http.StatusInternalServerError, errors.Responses.Fields.Subscription, errors.Responses.Keys.InternalServerError)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -69,7 +69,7 @@ func (mc *MembershipController) UpdateHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
var subscription models.SubscriptionModel
|
||||
var subscription models.Subscription
|
||||
if err := c.ShouldBindJSON(&subscription); err != nil {
|
||||
utils.HandleValidationError(c, err)
|
||||
return
|
||||
@@ -122,7 +122,7 @@ func (mc *MembershipController) DeleteSubscription(c *gin.Context) {
|
||||
func (mc *MembershipController) GetSubscriptions(c *gin.Context) {
|
||||
subscriptions, err := mc.Service.GetSubscriptions(nil)
|
||||
if err != nil {
|
||||
utils.RespondWithError(c, err, "Error retrieving subscriptions", http.StatusInternalServerError, errors.Responses.Fields.SubscriptionModel, errors.Responses.Keys.InternalServerError)
|
||||
utils.RespondWithError(c, err, "Error retrieving subscriptions", http.StatusInternalServerError, errors.Responses.Fields.Subscription, errors.Responses.Keys.InternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user