-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/add-metrics
- Loading branch information
Showing
22 changed files
with
1,370 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ lerna-debug.log* | |
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
/.vscode | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,4 @@ RUN yarn build | |
|
||
EXPOSE 3000 | ||
|
||
CMD ["yarn", "start"] | ||
|
||
|
||
CMD ["yarn", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import { NestFactory } from '@nestjs/core'; | ||
import { AppModule } from './app.module'; | ||
import tracer from './tracer'; | ||
|
||
const { PORT = 5000 } = process.env; | ||
|
||
async function bootstrap() { | ||
await tracer.start(); | ||
|
||
const app = await NestFactory.create(AppModule); | ||
await app.listen(3000); | ||
await app.listen(PORT); | ||
} | ||
bootstrap(); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Field, InputType, Int } from '@nestjs/graphql'; | ||
import { GraphQLJSONObject } from 'src/common/graphql/types/json.type'; | ||
|
||
export enum MenuItemAction { | ||
CREATE = 'create', | ||
UPDATE = 'update', | ||
DELETE = 'delete', | ||
} | ||
|
||
@InputType() | ||
export class MenuItemInput { | ||
@Field(() => Int, { nullable: true }) | ||
id?: number; | ||
|
||
@Field() | ||
label: string; | ||
|
||
@Field() | ||
action: MenuItemAction; | ||
|
||
@Field(() => Int) | ||
order: number; | ||
|
||
@Field(() => Int, { nullable: true }) | ||
parentId?: number; | ||
|
||
@Field(() => [MenuItemInput], { nullable: true }) | ||
children?: MenuItemInput[]; | ||
|
||
@Field(() => GraphQLJSONObject, { nullable: true }) | ||
meta?: object; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,59 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { CreateMenuItemInput } from './dto/create-menu-item.input'; | ||
import { UpdateMenuItemInput } from './dto/update-menu-item.input'; | ||
import { InjectRepository } from '@nestjs/typeorm'; | ||
import { Menu } from 'src/menus/entities/menu.entity'; | ||
import { Repository } from 'typeorm'; | ||
import { MenuItemAction, MenuItemInput } from './dto/menu-item.input'; | ||
import { MenuItem } from './entities/menu-item.entity'; | ||
|
||
@Injectable() | ||
export class MenuItemsService { | ||
create(createMenuInput: CreateMenuItemInput) { | ||
constructor( | ||
@InjectRepository(MenuItem) | ||
private menuItemRepository: Repository<MenuItem>, | ||
) {} | ||
create(createMenuInput: MenuItemInput) { | ||
return 'This action adds a new menu item'; | ||
} | ||
|
||
findAll(query: any) { | ||
return `This action returns all menu items`; | ||
// return `This action returns all menu items`; | ||
return this.menuItemRepository.find({ | ||
where: [{ menu: { id: query.menuId } }], | ||
}); | ||
} | ||
|
||
findOne(id: number) { | ||
return `This action returns a #${id} menu item`; | ||
} | ||
|
||
update(id: number, updateMenuInput: UpdateMenuItemInput) { | ||
update(id: number, updateMenuInput: MenuItemInput) { | ||
return `This action updates a #${id} menu item`; | ||
} | ||
|
||
remove(id: number) { | ||
return `This action removes a #${id} menu item`; | ||
} | ||
|
||
handle(menu: Menu, input: MenuItemInput) { | ||
if ( | ||
input.action == MenuItemAction.CREATE || | ||
input.action == MenuItemAction.UPDATE | ||
) { | ||
const item = new MenuItem(); | ||
|
||
item.id = input.id; | ||
item.label = input.label; | ||
item.order = input.order; | ||
item.menu = Promise.resolve(menu); | ||
|
||
return this.menuItemRepository.save(item); | ||
} | ||
|
||
if (input.action == MenuItemAction.DELETE) { | ||
this.menuItemRepository.delete(input.id); | ||
return; | ||
} | ||
|
||
throw new Error('unexpected action'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import { InputType, Field } from '@nestjs/graphql'; | ||
import { Field, InputType } from '@nestjs/graphql'; | ||
import { MenuItemInput } from 'src/menu-items/dto/menu-item.input'; | ||
|
||
@InputType() | ||
export class CreateMenuInput { | ||
@Field() | ||
name: string; | ||
|
||
@Field(() => [MenuItemInput], { nullable: true }) | ||
items?: MenuItemInput[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.