feat: add delete route for the invoice
This commit is contained in:
@@ -367,6 +367,18 @@ export class SubscriptionsService {
|
||||
return { workspaces: userSubscriptions };
|
||||
}
|
||||
|
||||
//************************************ */
|
||||
async checkUserAccessToService(userId: string, serviceId: string) {
|
||||
const userSubscriptions = await this.userSubscriptionsRepository.findOne({
|
||||
where: { user: { id: userId }, plan: { service: { id: serviceId } }, status: SubscriptionStatus.ACTIVE },
|
||||
relations: {
|
||||
plan: { service: true },
|
||||
staff: true,
|
||||
},
|
||||
});
|
||||
return userSubscriptions ? true : false;
|
||||
}
|
||||
|
||||
//************************************ */
|
||||
async addProvisioningJob(userSubscription: UserSubscription, plan: SubscriptionPlan, user: User) {
|
||||
this.logger.debug(`Adding provisioning job for user ${user.id} and subscription ${userSubscription.id}`);
|
||||
|
||||
@@ -94,9 +94,15 @@ export class SubscriptionsController {
|
||||
return this.userQuickAccessService.removeQuickAccess(userId, paramDto.id);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "check user access to a service" })
|
||||
@Get("check-access/:serviceId")
|
||||
checkUserAccessToService(@Param() serviceIdParamDto: ServiceIdParamDto, @UserDec("id") userId: string) {
|
||||
return this.subscriptionService.checkUserAccessToService(userId, serviceIdParamDto.serviceId);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "Check if user has access to a service and return all their workspaces for that service (internal use)" })
|
||||
@Get("workspaces/:serviceId")
|
||||
async getUserServiceAccess(@Param() serviceIdParamDto: ServiceIdParamDto, @UserDec("id") userId: string) {
|
||||
getUserServiceAccess(@Param() serviceIdParamDto: ServiceIdParamDto, @UserDec("id") userId: string) {
|
||||
return this.subscriptionService.getUserSubscriptionsForService(userId, serviceIdParamDto.serviceId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user