Compare commits
2 Commits
568c785504
...
5ae75e2349
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ae75e2349 | |||
| dcc89f14db |
@@ -16,11 +16,11 @@ export default class KitchenSeeder implements Seeder {
|
||||
}
|
||||
|
||||
await repository.save({
|
||||
name: 'Kitchen 1',
|
||||
name: 'Sattva',
|
||||
});
|
||||
|
||||
await repository.save({
|
||||
name: 'Kitchen 2',
|
||||
name: 'Swasthi',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
IsDateString,
|
||||
IsDecimal,
|
||||
IsInt,
|
||||
IsNotEmpty,
|
||||
@@ -7,6 +8,7 @@ import {
|
||||
IsPositive,
|
||||
IsString,
|
||||
} from 'class-validator';
|
||||
import { Column } from 'typeorm';
|
||||
|
||||
export class CreateInwardEntryDto {
|
||||
@IsNotEmpty()
|
||||
@@ -36,4 +38,9 @@ export class CreateInwardEntryDto {
|
||||
@IsNumber()
|
||||
@IsPositive()
|
||||
amount: number;
|
||||
|
||||
@IsString()
|
||||
company_name: string;
|
||||
@IsDateString()
|
||||
manufacuting_date: string;
|
||||
}
|
||||
|
||||
@@ -34,10 +34,7 @@ export class InventoryController {
|
||||
|
||||
@Post('inwards')
|
||||
async createInward(@CurrentUser() user, @Body() dto: CreateInwardDto) {
|
||||
return await this.inventoryService.createInward(
|
||||
dto,
|
||||
`${user.name} | ${user.email}`,
|
||||
);
|
||||
return await this.inventoryService.createInward(dto, user.sub);
|
||||
}
|
||||
|
||||
@Patch('inwards/:id')
|
||||
@@ -49,16 +46,13 @@ export class InventoryController {
|
||||
return await this.inventoryService.updateInward(
|
||||
id,
|
||||
updateInwardDto,
|
||||
`${user.name} | ${user.email}`,
|
||||
user.sub,
|
||||
);
|
||||
}
|
||||
|
||||
@Delete('inwards/:id')
|
||||
async deleteInward(@CurrentUser() user, @Param('id') id: string) {
|
||||
return await this.inventoryService.deleteInward(
|
||||
id,
|
||||
`${user.name} | ${user.email}`,
|
||||
);
|
||||
return await this.inventoryService.deleteInward(id, user.sub);
|
||||
}
|
||||
|
||||
@Delete('inward-entry/:entryId')
|
||||
@@ -66,10 +60,7 @@ export class InventoryController {
|
||||
@CurrentUser() user,
|
||||
@Param('entryId') entryId: string,
|
||||
) {
|
||||
return await this.inventoryService.deleteInwardEntry(
|
||||
entryId,
|
||||
`${user.name} | ${user.email}`,
|
||||
);
|
||||
return await this.inventoryService.deleteInwardEntry(entryId, user.sub);
|
||||
}
|
||||
|
||||
// --------------- INVENTORY MANAGEMENT ---------------
|
||||
@@ -93,7 +84,7 @@ export class InventoryController {
|
||||
body.name,
|
||||
body.stock,
|
||||
body.unit,
|
||||
`${user.name} | ${user.email}`,
|
||||
user.sub,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -117,15 +108,12 @@ export class InventoryController {
|
||||
return await this.inventoryService.updateInventoryItem(
|
||||
name,
|
||||
updateInventoryItemDto,
|
||||
`${user.name} | ${user.email}`,
|
||||
user.sub,
|
||||
);
|
||||
}
|
||||
|
||||
@Delete('inventory/:name')
|
||||
async deleteInventoryItem(@CurrentUser() user, @Param('name') name: string) {
|
||||
return await this.inventoryService.deleteInventoryItem(
|
||||
name,
|
||||
`${user.name} | ${user.email}`,
|
||||
);
|
||||
return await this.inventoryService.deleteInventoryItem(name, user.sub);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,10 +64,7 @@ export class KitchenInventoryController {
|
||||
@CurrentUser() user,
|
||||
@Param('id') id: string,
|
||||
) {
|
||||
await this.kitchenInventoryService.deleteFromKitchen(
|
||||
id,
|
||||
`${user.name} | ${user.email}`,
|
||||
);
|
||||
await this.kitchenInventoryService.deleteFromKitchen(id, user.sub);
|
||||
}
|
||||
|
||||
@Post('transfer')
|
||||
|
||||
@@ -29,10 +29,7 @@ export class UserController {
|
||||
@Roles('Admin')
|
||||
async create(@CurrentUser() user, @Body() createUserDto: CreateUserDto) {
|
||||
try {
|
||||
return this.userService.create(
|
||||
createUserDto,
|
||||
`${user.name} | ${user.email}`,
|
||||
);
|
||||
return this.userService.create(createUserDto, user.sub);
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
@@ -63,11 +60,7 @@ export class UserController {
|
||||
@Param('id') id: string,
|
||||
@Body() { password }: { password: string },
|
||||
) {
|
||||
await this.userService.updatePassword(
|
||||
id,
|
||||
password,
|
||||
`${user.name} | ${user.email}`,
|
||||
);
|
||||
await this.userService.updatePassword(id, password, user.sub);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
|
||||
8
src/vendor/vendor.controller.ts
vendored
8
src/vendor/vendor.controller.ts
vendored
@@ -24,7 +24,7 @@ export class VendorController {
|
||||
@CurrentUser() user,
|
||||
@Body() vendorData: CreateVendorDto,
|
||||
): Promise<void> {
|
||||
await this.vendorService.create(vendorData, `${user.name} | ${user.email}`);
|
||||
await this.vendorService.create(vendorData, user.sub);
|
||||
}
|
||||
|
||||
@Get()
|
||||
@@ -43,11 +43,7 @@ export class VendorController {
|
||||
@Param('id') id: string,
|
||||
@Body() updateVendorDto: UpdateVendorDto,
|
||||
) {
|
||||
this.vendorService.update(
|
||||
id,
|
||||
updateVendorDto,
|
||||
`${user.name} | ${user.email}`,
|
||||
);
|
||||
this.vendorService.update(id, updateVendorDto, user.sub);
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
|
||||
Reference in New Issue
Block a user