Skip to content

Commit 298940b

Browse files
committed
resolved compiler problems
1 parent 7c3320e commit 298940b

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

endpoints/account.endpoint.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func (accountEndpoint *AccountEndpoint) ByID(ctx *fiber.Ctx) error {
2323

2424
// Update function
2525
func (accountEndpoint *AccountEndpoint) Update(ctx *fiber.Ctx) error {
26-
if can := userEndpoint.Can(ctx, models.AdminRole); can != true {
26+
if can := userEndpoint.Can(ctx, models.AdminRole); !can {
2727
return ctx.Status(401).JSON(fiber.Map{
2828
"message": "You are not authorized to perform this action",
2929
})

endpoints/subscription.endpoint.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type SubscriptionEndpoint struct{ BaseEndpoint }
1414

1515
// Subscribe function
1616
func (subscriptionEndpoint *SubscriptionEndpoint) Subscribe(ctx *fiber.Ctx) error {
17-
if can := userEndpoint.Can(ctx, models.AdminRole); can != true {
17+
if can := userEndpoint.Can(ctx, models.AdminRole); !can {
1818
return ctx.Status(401).JSON(fiber.Map{
1919
"message": "You are not authorized to perform this action",
2020
})
@@ -40,7 +40,7 @@ func (subscriptionEndpoint *SubscriptionEndpoint) Subscribe(ctx *fiber.Ctx) erro
4040

4141
// GetCustomer function
4242
func (subscriptionEndpoint *SubscriptionEndpoint) GetCustomer(ctx *fiber.Ctx) error {
43-
if can := userEndpoint.Can(ctx, models.AdminRole); can != true {
43+
if can := userEndpoint.Can(ctx, models.AdminRole); !can {
4444
return ctx.Status(401).JSON(fiber.Map{
4545
"message": "You are not authorized to perform this action",
4646
})
@@ -57,7 +57,7 @@ func (subscriptionEndpoint *SubscriptionEndpoint) GetCustomer(ctx *fiber.Ctx) er
5757

5858
// GetCustomerInvoices function
5959
func (subscriptionEndpoint *SubscriptionEndpoint) GetCustomerInvoices(ctx *fiber.Ctx) error {
60-
if can := userEndpoint.Can(ctx, models.AdminRole); can != true {
60+
if can := userEndpoint.Can(ctx, models.AdminRole); !can {
6161
return ctx.Status(401).JSON(fiber.Map{
6262
"message": "You are not authorized to perform this action",
6363
})
@@ -75,7 +75,7 @@ func (subscriptionEndpoint *SubscriptionEndpoint) GetCustomerInvoices(ctx *fiber
7575

7676
// GetCustomerCards function
7777
func (subscriptionEndpoint *SubscriptionEndpoint) GetCustomerCards(ctx *fiber.Ctx) error {
78-
if can := userEndpoint.Can(ctx, models.AdminRole); can != true {
78+
if can := userEndpoint.Can(ctx, models.AdminRole); !can {
7979
return ctx.Status(401).JSON(fiber.Map{
8080
"message": "You are not authorized to perform this action",
8181
})
@@ -103,6 +103,11 @@ func (subscriptionEndpoint *SubscriptionEndpoint) CancelSubscription(ctx *fiber.
103103
_, err := govalidator.ValidateMap(inputMap, map[string]interface{}{
104104
"subscriptionId": "ascii,required",
105105
})
106+
if err != nil {
107+
return ctx.Status(401).JSON(fiber.Map{
108+
"message": err.Error(),
109+
})
110+
}
106111
account, _ := userEndpoint.CurrentAccount(ctx)
107112
sCustomer, err := subscriptionService.CancelSubscription(account.ID, inputMap["subscriptionId"].(string))
108113
if err != nil {

endpoints/user.endpoint.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func (userEndpoint *UserEndpoint) GenerateSso(ctx *fiber.Ctx) error {
9191

9292
// Index function
9393
func (userEndpoint *UserEndpoint) Index(ctx *fiber.Ctx) error {
94-
if can := userEndpoint.Can(ctx, models.AdminRole); can != true {
94+
if can := userEndpoint.Can(ctx, models.AdminRole); !can {
9595
return ctx.Status(401).JSON(fiber.Map{
9696
"message": "You are not authorized to perform this action",
9797
})
@@ -111,7 +111,7 @@ func (userEndpoint *UserEndpoint) Index(ctx *fiber.Ctx) error {
111111
// Create function
112112
func (userEndpoint *UserEndpoint) Create(ctx *fiber.Ctx) error {
113113
me, _ := userEndpoint.CurrentUser(ctx)
114-
if can := userEndpoint.Can(ctx, models.AdminRole); can != true {
114+
if can := userEndpoint.Can(ctx, models.AdminRole); !can {
115115
return ctx.Status(401).JSON(fiber.Map{
116116
"message": "You are not authorized to perform this action",
117117
})
@@ -144,7 +144,7 @@ func (userEndpoint *UserEndpoint) Create(ctx *fiber.Ctx) error {
144144

145145
// Update function
146146
func (userEndpoint *UserEndpoint) Update(ctx *fiber.Ctx) error {
147-
if can := userEndpoint.Can(ctx, models.AdminRole); can != true {
147+
if can := userEndpoint.Can(ctx, models.AdminRole); !can {
148148
return ctx.Status(401).JSON(fiber.Map{
149149
"message": "You are not authorized to perform this action",
150150
})
@@ -178,7 +178,7 @@ func (userEndpoint *UserEndpoint) Delete(ctx *fiber.Ctx) error {
178178
me, _ := userEndpoint.CurrentUser(ctx)
179179
can := userEndpoint.Can(ctx, models.AdminRole)
180180
can = can && me.ID.Hex() != ctx.Params("id")
181-
if can == false {
181+
if !can {
182182
return ctx.Status(401).JSON(fiber.Map{
183183
"message": "You are not authorized to perform this action",
184184
})

0 commit comments

Comments
 (0)