Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #465

Merged
merged 93 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
0a6668e
implement the menu search
olasunkanmi-SE Jul 26, 2023
ff364d1
fix code smell
olasunkanmi-SE Jul 26, 2023
65b6009
calculate service charge
olasunkanmi-SE Sep 11, 2023
c6c683f
update sonar project config
olasunkanmi-SE Sep 11, 2023
cc60885
update total order calculation
olasunkanmi-SE Sep 11, 2023
d2dfe38
add cart items to order
olasunkanmi-SE Sep 11, 2023
541a0a3
move email header check to the backend
olasunkanmi-SE Sep 11, 2023
55765a0
remove quantity from order
olasunkanmi-SE Sep 23, 2023
5c3e4c7
Merge branch 'release' into development
olasunkanmi-SE Sep 23, 2023
f0dfa7b
update selected items to include itemId
olasunkanmi-SE Sep 23, 2023
faa996d
Merge branch 'development' of github.com:olasunkanmi-SE/restaurant in…
olasunkanmi-SE Sep 23, 2023
dead621
make cartitem and selectedCart Items optional in parent models
olasunkanmi-SE Sep 23, 2023
0dcffa7
Merge branch 'release' into development
olasunkanmi-SE Sep 23, 2023
ad8f925
create the order service
olasunkanmi-SE Sep 24, 2023
ddb05dd
Merge branch 'development' of github.com:olasunkanmi-SE/restaurant in…
olasunkanmi-SE Sep 24, 2023
e28d2ef
Merge branch 'release' into development
olasunkanmi-SE Sep 24, 2023
a83f120
create order controller
olasunkanmi-SE Sep 24, 2023
d90a534
checkout and fix (#391)
olasunkanmi-SE Oct 24, 2023
a998d1e
Test (#393)
olasunkanmi-SE Oct 24, 2023
599e37c
Test (#396)
olasunkanmi-SE Oct 24, 2023
3ab65de
Merge branch 'release' into development
olasunkanmi-SE Oct 24, 2023
35a3d9d
Test (#400)
olasunkanmi-SE Oct 25, 2023
b6dd7f1
Test (#403)
olasunkanmi-SE Oct 26, 2023
c094940
Merge branch 'release' into development
olasunkanmi-SE Oct 26, 2023
2bd6071
create the create order service
olasunkanmi-SE Oct 29, 2023
1d3abea
Merge branch 'release' into development
olasunkanmi-SE Oct 29, 2023
b4f6733
create order
olasunkanmi-SE Oct 29, 2023
f118a7b
Merge branch 'development' of github.com:olasunkanmi-SE/restaurant in…
olasunkanmi-SE Oct 29, 2023
420f2a9
Merge branch 'release' into development
olasunkanmi-SE Oct 29, 2023
325edb9
check for duplicate orders before creating one
olasunkanmi-SE Nov 12, 2023
736597c
Merge branch 'release' into development
olasunkanmi-SE Nov 12, 2023
dc6f1b4
Merge branch 'release' of github.com:olasunkanmi-SE/restaurant into d…
olasunkanmi-SE Nov 12, 2023
4766447
Merge branch 'development' of github.com:olasunkanmi-SE/restaurant in…
olasunkanmi-SE Nov 12, 2023
2f47f7b
remove ChatGpt code reviewer
olasunkanmi-SE Nov 12, 2023
db513a6
create order statuses domain entity
olasunkanmi-SE Nov 12, 2023
b6fb0db
create the order status schema
olasunkanmi-SE Nov 12, 2023
5621a88
create orser status mapper
olasunkanmi-SE Nov 12, 2023
fa05846
Merge branch 'release' into development
olasunkanmi-SE Nov 12, 2023
0a091da
Merge branch 'release' of github.com:olasunkanmi-SE/restaurant into d…
olasunkanmi-SE Nov 12, 2023
b969d63
Merge branch 'development' of github.com:olasunkanmi-SE/restaurant in…
olasunkanmi-SE Nov 12, 2023
d190169
create the order status service
olasunkanmi-SE Nov 14, 2023
5384610
fix merge conflicts
olasunkanmi-SE Nov 14, 2023
816f4fa
resolve all dependencies
olasunkanmi-SE Nov 14, 2023
e015c8e
Merge branch 'release' into development
olasunkanmi-SE Nov 14, 2023
7fbaa09
create order notes
olasunkanmi-SE Nov 14, 2023
b4fdecf
Merge branch 'development' of github.com:olasunkanmi-SE/restaurant in…
olasunkanmi-SE Nov 14, 2023
ca70c26
Merge branch 'release' into development
olasunkanmi-SE Nov 14, 2023
da7db0c
fix build error
olasunkanmi-SE Nov 14, 2023
ac22f15
Merge branch 'development' of github.com:olasunkanmi-SE/restaurant in…
olasunkanmi-SE Nov 14, 2023
307c9c4
fix build error
olasunkanmi-SE Nov 14, 2023
977cddf
fix build errors
olasunkanmi-SE Nov 14, 2023
eaee17b
add order notes module to app module
olasunkanmi-SE Nov 14, 2023
97c5275
create the order processing queue module
olasunkanmi-SE Nov 14, 2023
35d9a23
Merge branch 'release' of github.com:olasunkanmi-SE/restaurant into d…
olasunkanmi-SE Nov 14, 2023
de9c032
update app module with OrderProcessingQueuesModule
olasunkanmi-SE Nov 14, 2023
ff7a24b
Merge branch 'release' into development
olasunkanmi-SE Nov 14, 2023
831116b
create the get orders method
olasunkanmi-SE Nov 15, 2023
9df6314
get orders (#429)
olasunkanmiraymond Nov 17, 2023
4b06c19
add notes to menui
olasunkanmi-SE Nov 18, 2023
ec66d58
Merge branch 'development' of github.com:olasunkanmi-SE/restaurant in…
olasunkanmi-SE Nov 18, 2023
8773105
remove notes from menu
olasunkanmi-SE Nov 19, 2023
395746d
remove notes from menu
olasunkanmi-SE Nov 19, 2023
c482350
Merge branch 'release' into development
olasunkanmi-SE Nov 19, 2023
fe23a3f
remove notes from menu
olasunkanmi-SE Nov 19, 2023
f146115
include menuId in ordernote domain
olasunkanmi-SE Nov 19, 2023
122d874
to be fixed remotely
olasunkanmi-SE Nov 20, 2023
7c6a94e
Development (#437)
olasunkanmiraymond Nov 20, 2023
889f38c
Development (#439)
olasunkanmiraymond Nov 20, 2023
5677469
Development (#442)
olasunkanmiraymond Nov 20, 2023
760dbbe
Merge branch 'release' into development
olasunkanmi-SE Nov 20, 2023
e4bd9ed
create order notes through order service
olasunkanmi-SE Nov 20, 2023
67534ec
Merge branch 'release' into development
olasunkanmi-SE Nov 20, 2023
a6a67e8
update order processing queue service
olasunkanmi-SE Nov 20, 2023
97e21d6
Merge branch 'development' of github.com:olasunkanmi-SE/restaurant in…
olasunkanmi-SE Nov 20, 2023
68cc793
on create order, create order status queue
olasunkanmi-SE Nov 20, 2023
6b4cfa3
Merge branch 'release' into development
olasunkanmi-SE Nov 20, 2023
635393e
fix issues within order statuses api
olasunkanmi-SE Nov 20, 2023
e92ea4b
Development (#451)
olasunkanmiraymond Nov 21, 2023
b378c76
insert order note, order queue status in db
olasunkanmi-SE Nov 22, 2023
64c563b
Merge branch 'release' into development
olasunkanmi-SE Nov 22, 2023
0b4c17c
remove unused import
olasunkanmi-SE Nov 22, 2023
9315071
Merge branch 'development' of github.com:olasunkanmi-SE/restaurant in…
olasunkanmi-SE Nov 22, 2023
6161bf7
fix build errors
olasunkanmi-SE Nov 22, 2023
91dc8b3
Development (#455)
olasunkanmiraymond Nov 22, 2023
a93626c
Merge branch 'release' into development
olasunkanmi-SE Nov 22, 2023
c64efc5
implement Role based access control
olasunkanmi-SE Dec 5, 2023
e587431
fix build errors
olasunkanmi-SE Dec 5, 2023
4a8de90
return values from mapRoleToPriority
olasunkanmi-SE Dec 5, 2023
e35faf8
create the basic order response
Dec 8, 2023
7521439
fix error in order data model
Dec 11, 2023
de0166a
change merchant module to singlecleint (#461)
olasunkanmi-SE Dec 11, 2023
7a68efa
fic conflicts
Dec 11, 2023
eb04fdf
update the menus url
Jan 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions backend/src/addon/addon.module.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { SingleClientMapper } from '../singleclient/singleclient.mapper';
import { SingleClientRepository } from './../infrastructure/data_access/repositories/singleclient.repository';
import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import { MongooseModule } from '@nestjs/mongoose';
Expand All @@ -8,43 +10,38 @@ import { AuthService } from './../infrastructure/auth/auth.service';
import { ContextService } from './../infrastructure/context/context.service';
import { AddonRepository } from './../infrastructure/data_access/repositories/addon.repository';
import { CategoryRepository } from './../infrastructure/data_access/repositories/category.repository';
import { MerchantRepository } from './../infrastructure/data_access/repositories/merchant.repository';
import {
CategoryDataModel,
CategorySchema,
} from './../infrastructure/data_access/repositories/schemas/category.schema';
import {
MerchantDataModel,
MerchantSchema,
} from './../infrastructure/data_access/repositories/schemas/merchant.schema';
import { ContextMiddleWare } from './../infrastructure/middlewares/context.middleware';
import { MerchantMapper } from './../merchant/merchant.mapper';
import { MerchantService } from './../merchant/merchant.service';
import { ValidateUser } from './../utils/context-validation';
import { AddonController } from './addon.controller';
import { AddonMapper } from './addon.mapper';
import { AddonDataModel, AddonSchema } from './addon.schema';
import { AddonService } from './addon.service';
import { SingleClientDataModel, SingleClientSchema } from '../infrastructure';
import { SingleClientService } from 'src/singleclient/singleclient.service';

@Module({
imports: [
MongooseModule.forFeature([
{ name: AddonDataModel.name, schema: AddonSchema },
{ name: MerchantDataModel.name, schema: MerchantSchema },
{ name: SingleClientDataModel.name, schema: SingleClientSchema },
{ name: CategoryDataModel.name, schema: CategorySchema },
]),
],
controllers: [AddonController],
providers: [
{ provide: TYPES.IContextService, useClass: ContextService },
{ provide: TYPES.IMerchantService, useClass: MerchantService },
{ provide: TYPES.ISingleClientService, useClass: SingleClientService },
{ provide: TYPES.IAuthService, useClass: AuthService },
{ provide: TYPES.IValidateUser, useClass: ValidateUser },
{ provide: TYPES.IAddonService, useClass: AddonService },
AddonRepository,
AddonMapper,
MerchantRepository,
MerchantMapper,
SingleClientRepository,
SingleClientMapper,
JwtService,
AuditMapper,
CategoryRepository,
Expand Down
8 changes: 4 additions & 4 deletions backend/src/addon/addon.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ import { Context } from './../infrastructure/context/context';
import { IContextService } from './../infrastructure/context/context-service.interface';
import { AddonRepository } from './../infrastructure/data_access/repositories/addon.repository';
import { throwApplicationError } from './../infrastructure/utilities/exception-instance';
import { IMerchantService } from './../merchant/interface/merchant-service.interface';
import { Addon } from './addon';
import { IAddonService } from './addon-service.interface';
import { AddonMapper } from './addon.mapper';
import { AddonDataModel } from './addon.schema';
import { CreateAddonDTO } from './create-addon.dto';
import { ISingleClientService } from '../singleclient/interface/singleclient-service.interface';

@Injectable()
export class AddonService implements IAddonService {
private context: Context;
constructor(
@Inject(TYPES.IContextService)
private readonly contextService: IContextService,
@Inject(TYPES.IMerchantService) private readonly merchantService: IMerchantService,
@Inject(TYPES.ISingleClientService) private readonly singleclientService: ISingleClientService,
private readonly categoryRepository: CategoryRepository,
private readonly addonRepository: AddonRepository,
private readonly addonMapper: AddonMapper,
Expand All @@ -33,7 +33,7 @@ export class AddonService implements IAddonService {

async createAddon(props: CreateAddonDTO): Promise<Result<IAddonResponseDTO>> {
const { name } = props;
await this.merchantService.validateContext();
await this.singleclientService.validateContext();
const existingItem = await this.addonRepository.findOne({ name });
if (existingItem.isSuccess) {
throwApplicationError(HttpStatus.BAD_REQUEST, `Item ${name} already exists`);
Expand All @@ -57,7 +57,7 @@ export class AddonService implements IAddonService {
}

async getAddons(): Promise<Result<IAddonResponseDTO[]>> {
await this.merchantService.validateContext();
await this.singleclientService.validateContext();
const addonsDoc = await this.addonRepository.getAddons();
const addons: Addon[] = addonsDoc.map((addon) => this.addonMapper.toDomain(addon));
const response: IAddonResponseDTO[] = AddonParser.createAddonsResponse(addons);
Expand Down
4 changes: 2 additions & 2 deletions backend/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { AuthModule } from './infrastructure/auth';
import { ContextService } from './infrastructure/context';
import { ContextMiddleWare } from './infrastructure/middlewares';
import { ItemModule } from './item/item.module';
import { MerchantModule } from './merchant/merchant.module';
import { SingleClientModule } from './singleclient/singleclient.module';
import { ApplicationExceptionsFilter, ApplicationLogger } from './infrastructure';
import { LocationModule } from './location';
import { OrderModule } from './order/order.module';
Expand Down Expand Up @@ -44,7 +44,7 @@ import { OrderProcessingQueuesModule } from './order_processing_queue/order_proc
ConfigModule.forRoot(),
LocationModule,
RestaurantModule,
MerchantModule,
SingleClientModule,
AuthModule,
ItemModule,
MenuModule,
Expand Down
2 changes: 1 addition & 1 deletion backend/src/application/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const APIResponseMessage = {

export const saltRounds = 10;

export enum MerchantStatus {
export enum SingleClientStatus {
onBoarding = 'onBoarding',
boarded = 'boarded',
banned = 'banned',
Expand Down
4 changes: 2 additions & 2 deletions backend/src/application/constants/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const TYPES = {
IApplicationLogger: Symbol('IApplicationLogger'),
ILocationService: Symbol('ILocationService'),
IRestaurantService: Symbol('IRestaurantService'),
IMerchantService: Symbol('IMerchantService'),
ISingleClientService: Symbol('ISingleClientService'),
IRestaurantRepository: Symbol('IRestaurantRepository'),
IItemService: Symbol('IItemService'),
IMenuService: Symbol('IMenuService'),
Expand All @@ -29,7 +29,7 @@ export const TYPES = {
IOrderNoteService: Symbol('IOrderNoteService'),
IOrderProcessingQueueRepository: Symbol('IOrderProcessingQueueRepository'),
IOrderProcessingQueueService: Symbol('IOrderProcessingQueueService'),
IMerchantRepository: Symbol('IMerchantRepository'),
ISingleClientRepository: Symbol('ISingleClientRepository'),
IRoleService: Symbol('IRoleService'),
IAccessControlService: Symbol('IAccessControlService'),
};
20 changes: 10 additions & 10 deletions backend/src/category/category.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import { AuditMapper } from './../audit/audit.mapper';
import { AuthService } from './../infrastructure/auth/auth.service';
import { ContextService } from './../infrastructure/context/context.service';
import { CategoryRepository } from './../infrastructure/data_access/repositories/category.repository';
import { MerchantRepository } from './../infrastructure/data_access/repositories/merchant.repository';
import { SingleClientRepository } from './../infrastructure/data_access/repositories/singleclient.repository';
import {
CategoryDataModel,
CategorySchema,
} from './../infrastructure/data_access/repositories/schemas/category.schema';
import {
MerchantDataModel,
MerchantSchema,
} from './../infrastructure/data_access/repositories/schemas/merchant.schema';
SingleClientDataModel,
SingleClientSchema,
} from './../infrastructure/data_access/repositories/schemas/singleclient.schema';
import { ContextMiddleWare } from './../infrastructure/middlewares/context.middleware';
import { MerchantMapper } from './../merchant/merchant.mapper';
import { MerchantService } from './../merchant/merchant.service';
import { SingleClientMapper } from './../singleclient/singleclient.mapper';
import { SingleClientService } from './../singleclient/singleclient.service';
import { ValidateUser } from './../utils/context-validation';
import { CategoryController } from './category.controller';
import { CategoryMapper } from './category.mapper';
Expand All @@ -26,21 +26,21 @@ import { CategoryService } from './category.service';
imports: [
MongooseModule.forFeature([
{ name: CategoryDataModel.name, schema: CategorySchema },
{ name: MerchantDataModel.name, schema: MerchantSchema },
{ name: SingleClientDataModel.name, schema: SingleClientSchema },
]),
],
controllers: [CategoryController],
providers: [
{ provide: TYPES.IContextService, useClass: ContextService },
{ provide: TYPES.IMerchantService, useClass: MerchantService },
{ provide: TYPES.ISingleClientService, useClass: SingleClientService },
{ provide: TYPES.IAuthService, useClass: AuthService },
{ provide: TYPES.IValidateUser, useClass: ValidateUser },
{ provide: TYPES.ICategoryService, useClass: CategoryService },
CategoryRepository,
JwtService,
AuditMapper,
MerchantRepository,
MerchantMapper,
SingleClientRepository,
SingleClientMapper,
CategoryMapper,
],
})
Expand Down
10 changes: 5 additions & 5 deletions backend/src/category/category.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Result } from './../domain/result/result';
import { IContextService } from './../infrastructure/context/context-service.interface';
import { CategoryRepository } from './../infrastructure/data_access/repositories/category.repository';
import { throwApplicationError } from './../infrastructure/utilities/exception-instance';
import { IMerchantService } from './../merchant/interface/merchant-service.interface';
import { ISingleClientService } from './../singleclient/interface/singleclient-service.interface';
import { Category } from './category';
import { ICategoryService } from './category-service.interface';
import { CategoryMapper } from './category.mapper';
Expand All @@ -21,7 +21,7 @@ export class CategoryService implements ICategoryService {
private context: Context;
constructor(
@Inject(TYPES.IContextService) private readonly contextService: IContextService,
@Inject(TYPES.IMerchantService) private readonly merchantService: IMerchantService,
@Inject(TYPES.ISingleClientService) private readonly singleclientService: ISingleClientService,
private readonly categoryRepository: CategoryRepository,
private readonly categoryMapper: CategoryMapper,
) {
Expand All @@ -30,7 +30,7 @@ export class CategoryService implements ICategoryService {
async createCategory(props: CreateCategoryDTO): Promise<Result<ICategoryResponseDTO>> {
const { name } = props;
const code = name.toUpperCase();
await this.merchantService.validateContext();
await this.singleclientService.validateContext();
const existingItem = await this.categoryRepository.findOne({ name });
if (existingItem.isSuccess) {
throwApplicationError(HttpStatus.BAD_REQUEST, `Item ${name} already exists`);
Expand All @@ -47,14 +47,14 @@ export class CategoryService implements ICategoryService {
}

async getCategories(): Promise<Result<ICategoryResponseDTO[]>> {
await this.merchantService.validateContext();
await this.singleclientService.validateContext();
const result: Result<Category[]> = await this.categoryRepository.find({});
const response: ICategoryResponseDTO[] = CategoryParser.createCategoriesResponse(result.getValue());
return Result.ok(response);
}

async getCategoryById(id: Types.ObjectId): Promise<Result<ICategoryResponseDTO>> {
await this.merchantService.validateContext();
await this.singleclientService.validateContext();
const result: Result<Category> = await this.categoryRepository.findById(id);
const response: ICategoryResponseDTO = CategoryParser.createCategoryResponse(result.getValue());
return Result.ok(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export * from './interfaces/addon-repository.interface';
export * from './addon.repository';
export * from './item.repository';
export * from './menu.repopsitory';
export * from './merchant.repository';
export * from './singleclient.repository';
export * from './interfaces/addon-repository.interface';
export * from './addon.repository';
export * from './order-manager.repository';
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export interface IMenuRepository {
getMenuById(id: Types.ObjectId): Promise<any>;
createMenu(menuModel: MenuDataModel): Promise<Result<any>>;
deleteMenu(id: Types.ObjectId);
getMenuByRestaurantId(restaurantId: string, merchantId: string): Promise<Result<Menu[]>>;
getMenuByRestaurantId(restaurantId: string, singleclientId: string): Promise<Result<Menu[]>>;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IGenericDocument } from 'src/infrastructure/database';
import { Merchant } from 'src/merchant';
import { MerchantDocument } from '../schemas';
import { SingleClient } from 'src/singleclient';
import { SingleClientDocument } from '../schemas';

export interface IMerchantRepository extends IGenericDocument<Merchant, MerchantDocument> {}
export interface ISingleClientRepository extends IGenericDocument<SingleClient, SingleClientDocument> {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import { CreateCartItemsDTO } from 'src/order/dto/create-order.dto';

export interface IOrderRepository extends IGenericDocument<Order, OrderDocument> {
createOrder(order: OrderDataModel): Promise<Result<Order>>;
getDuplicateOrder(type: string, merchantId: string, cartItems: CreateCartItemsDTO[]): Promise<boolean>;
getDuplicateOrder(type: string, singleclientId: string, cartItems: CreateCartItemsDTO[]): Promise<boolean>;
getOrders(): Promise<Result<Order[]>>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Restaurant } from '../../../../restaurant/restaurant';
import { IGenericDocument } from '../../../database/mongoDB/generic-document.interface';
import { RestaurantDocument } from '../schemas';
export interface IRestaurantRepository extends IGenericDocument<Restaurant, RestaurantDocument> {
getRestaurantWithMerchantDetails(restaurant: Restaurant, merchantId: Types.ObjectId): Promise<Restaurant>;
getRestaurantWithSingleClientDetails(restaurant: Restaurant, singleclientId: Types.ObjectId): Promise<Restaurant>;
getRestaurant(restaurantId: Types.ObjectId): Promise<Restaurant>;
getRestaurants(): Promise<Restaurant[]>;
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from './location-model.interface';
export * from './merchant-model.interface';
export * from './singleclient-model.interface';
export * from './restaurant-model.interface';
export * from './item-model.interface';
export * from './menu-model.interface';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { MerchantDataModel } from '../schemas';
import { SingleClientDataModel } from '../schemas';

export interface IOrderManagerDataModel {
readonly firstName: string;
readonly lastName: string;
readonly email: string;
readonly phoneNumber?: string;
readonly merchant: MerchantDataModel;
readonly singleclient: SingleClientDataModel;
readonly role: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { OrderStatusModel } from '../schemas/order-status.schema';
export interface IOrderDataModel {
readonly state: OrderStatusModel;
readonly type: dinningType;
readonly merchantId: Types.ObjectId;
readonly singleclientId: Types.ObjectId;
readonly customerId?: Types.ObjectId;
readonly total: number;
readonly discount?: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface IRestaurantdata {
readonly logoUrl?: string;
readonly timeZone?: string;
readonly phoneNumber: string;
readonly merchantId: Types.ObjectId;
readonly singleclientId: Types.ObjectId;
readonly location: LocationData;
readonly opened: boolean;
readonly imageUrl: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface IMerchantData {
export interface ISingleClientData {
readonly firstName: string;
readonly lastName: string;
readonly email: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class OrderRepository extends GenericDocumentRepository<Order, OrderDocum
return response ? Result.ok(response) : Result.fail('Could not create order', HttpStatus.INTERNAL_SERVER_ERROR);
}

async getDuplicateOrder(type: string, merchantId: string, cartItems: CreateCartItemsDTO[]): Promise<boolean> {
async getDuplicateOrder(type: string, singleclientId: string, cartItems: CreateCartItemsDTO[]): Promise<boolean> {
const currentTime: Date = new Date();
const initDuplicateTimeFrameInMinutes = 60 * 1000;
const finalDuplicateTimeFrameInMinutes = initDuplicateTimeFrameInMinutes * 4;
Expand All @@ -35,7 +35,7 @@ export class OrderRepository extends GenericDocumentRepository<Order, OrderDocum
const selectedItemIds = selectedItems.map((item) => item.itemId);
const result: Result<Order[]> = await this.find({
type,
merchantId,
singleclientId,
cartItems: { $elemMatch: { $in: selectedItemIds } },
auditCreatedDateTime: {
$gte: initDuplicateTimeInMilliSeconds,
Expand Down
Loading
Loading