subscription start and end date
This commit is contained in:
@@ -45,7 +45,7 @@ export class PaymentsController {
|
||||
@ApiOperation({ summary: 'Get all the restaurant payments for user' })
|
||||
@ApiHeader(API_HEADER_SLUG)
|
||||
findAllByRestaurant(@UserId() userId: string, @RestId() restId: string) {
|
||||
return this.paymentsService.findAllByRestaurantId(restId, userId);
|
||||
return this.paymentsService.findAllPaymentsByRestaurantId(restId, userId);
|
||||
}
|
||||
|
||||
@UseGuards(AuthGuard)
|
||||
|
||||
@@ -219,7 +219,7 @@ export class PaymentsService {
|
||||
return payment;
|
||||
}
|
||||
|
||||
findAllByRestaurantId(restId: string, userId: string) {
|
||||
findAllPaymentsByRestaurantId(restId: string, userId: string) {
|
||||
return this.em.find(
|
||||
Payment,
|
||||
{ order: { restaurant: { id: restId }, user: { id: userId } } },
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IsString, IsOptional, IsNumber } from 'class-validator';
|
||||
import { IsString, IsOptional, IsNumber, IsDate } from 'class-validator';
|
||||
|
||||
export class CreateRestaurantDto {
|
||||
@ApiProperty({ example: 'کافه ژیوان', description: 'نام رستوران' })
|
||||
@@ -24,4 +24,12 @@ export class CreateRestaurantDto {
|
||||
@IsString()
|
||||
subscriptionId!: string;
|
||||
|
||||
@ApiProperty({ example: '2025-12-26', description: 'تاریخ انقضای اشتراک' })
|
||||
@IsDate()
|
||||
subscriptionEndDate!: Date;
|
||||
|
||||
@ApiProperty({ example: '2025-12-26', description: 'تاریخ شروع اشتراک' })
|
||||
@IsDate()
|
||||
subscriptionStartDate!: Date;
|
||||
|
||||
}
|
||||
|
||||
@@ -102,4 +102,11 @@ export class Restaurant extends BaseEntity {
|
||||
|
||||
@Property({unique: true})
|
||||
subscriptionId!: string;
|
||||
|
||||
@Property()
|
||||
subscriptionEndDate!: Date;
|
||||
|
||||
@Property()
|
||||
subscriptionStartDate!: Date;
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ export class RestaurantsService {
|
||||
plan: PlanEnum.Base,
|
||||
domain: `https://dmenu-plus-front.dev.danakcorp.com/${dto.slug}`,
|
||||
subscriptionId: dto.subscriptionId,
|
||||
subscriptionEndDate: dto.subscriptionEndDate,
|
||||
subscriptionStartDate: dto.subscriptionStartDate,
|
||||
});
|
||||
|
||||
await this.em.persistAndFlush(restaurant);
|
||||
|
||||
Reference in New Issue
Block a user