update: the danak services module and add new route to fetch the danak service
This commit is contained in:
@@ -16,6 +16,7 @@ import { ParamDto } from "../../common/DTO/param.dto";
|
||||
import { PermissionEnum } from "../users/enums/permission.enum";
|
||||
|
||||
@Controller("subscriptions")
|
||||
@AuthGuards()
|
||||
export class SubscriptionsController {
|
||||
constructor(
|
||||
private readonly subscriptionService: SubscriptionsService,
|
||||
@@ -23,7 +24,6 @@ export class SubscriptionsController {
|
||||
) {}
|
||||
|
||||
@ApiOperation({ summary: "Create a subscription plan" })
|
||||
@AuthGuards()
|
||||
@PermissionsDec(PermissionEnum.SERVICES)
|
||||
@Post()
|
||||
createSubscription(@Body() createDto: AddSubscriptionsToServiceDto) {
|
||||
@@ -31,7 +31,6 @@ export class SubscriptionsController {
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "get all subscription plans" })
|
||||
@AuthGuards()
|
||||
@PermissionsDec(PermissionEnum.SERVICES)
|
||||
@Get("service/:serviceId")
|
||||
getServiceSubscriptions(@Param() paramDto: ServiceIdParamDto, @Query() queryDto: ServiceSubsQueryDto) {
|
||||
@@ -39,21 +38,18 @@ export class SubscriptionsController {
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "get all user subscriptions ==> user route" })
|
||||
@AuthGuards()
|
||||
@Get("user")
|
||||
getUserSubscriptions(@UserDec("id") userId: string, @Query() queryDto: SearchUserSubsQueryDto) {
|
||||
return this.subscriptionService.getUserSubscriptions(userId, queryDto);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "get a user subscription by id ==> user route" })
|
||||
@AuthGuards()
|
||||
@Get("user/:id")
|
||||
getUserSubscriptionById(@Param() paramDto: ParamDto, @UserDec("id") userId: string) {
|
||||
return this.subscriptionService.getUserSubscriptionById(paramDto.id, userId);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "toggle status of service subs" })
|
||||
@AuthGuards()
|
||||
@PermissionsDec(PermissionEnum.SERVICES)
|
||||
@Post("toggle-status/:id")
|
||||
toggleStatusOfServiceSub(@Param() paramDto: ParamDto) {
|
||||
@@ -61,7 +57,6 @@ export class SubscriptionsController {
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "get a subscription plan by id" })
|
||||
@AuthGuards()
|
||||
@Get(":id")
|
||||
@PermissionsDec(PermissionEnum.SERVICES)
|
||||
getSubscription(@Param() paramDto: ParamDto) {
|
||||
@@ -69,7 +64,6 @@ export class SubscriptionsController {
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "update a subscription plan by id" })
|
||||
@AuthGuards()
|
||||
@Patch(":id")
|
||||
//TODO:fix this if needed
|
||||
@PermissionsDec(PermissionEnum.SERVICES)
|
||||
@@ -78,28 +72,24 @@ export class SubscriptionsController {
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "subscribe to a service ==> user route" })
|
||||
@AuthGuards()
|
||||
@Post(":serviceId/subscribe")
|
||||
subscribe(@Param() paramDto: ServiceIdParamDto, @Body() subscribeDto: SubscribeServiceDto, @UserDec("id") userId: string) {
|
||||
return this.subscriptionService.subscribeToPlan(paramDto.serviceId, subscribeDto, userId);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "add quick access a service ==> user route" })
|
||||
@AuthGuards()
|
||||
@Post(":id/add-quick-access")
|
||||
addQuickAccess(@Param() paramDto: ParamDto, @UserDec("id") userId: string) {
|
||||
return this.userQuickAccessService.addQuickAccess(userId, paramDto.id);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "get quick access a service ==> user route" })
|
||||
@AuthGuards()
|
||||
@Get("quick-access")
|
||||
getQuickAccess(@UserDec("id") userId: string) {
|
||||
return this.userQuickAccessService.getUserQuickAccess(userId);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "remove quick access a service ==> user route" })
|
||||
@AuthGuards()
|
||||
@Delete(":id/remove-quick-access")
|
||||
removeQuickAccess(@Param() paramDto: ParamDto, @UserDec("id") userId: string) {
|
||||
return this.userQuickAccessService.removeQuickAccess(userId, paramDto.id);
|
||||
|
||||
Reference in New Issue
Block a user