Merge branch 'development' into 'devops-staging'

Development

See merge request empatnusabangsa/ppob/ppob-backend!41
This commit is contained in:
Catur Bagaskara 2021-12-21 06:36:53 +00:00
commit e56c63911c
6 changed files with 35 additions and 10 deletions

View File

@ -11,7 +11,7 @@
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:formatted": "nest start | pino-pretty",
"start:dev": "nest start --watch",
"start:dev": "nest start --watch | pino-pretty",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",

View File

@ -1,23 +1,23 @@
import {
Body,
Controller,
Get,
Post,
Body,
Put,
Param,
Delete,
ParseUUIDPipe,
HttpStatus,
Param,
ParseUUIDPipe,
Post,
Put,
Query,
UseInterceptors,
UploadedFile,
Res,
UploadedFile,
UseInterceptors,
} from '@nestjs/common';
import { RoleService } from './roles.service';
import { CommissionService } from './commission.service';
import { FileInterceptor } from '@nestjs/platform-express';
import { diskStorage } from 'multer';
import { editFileName } from '../helper/file-handler';
import { Public } from 'src/auth/public.decorator';
@Controller({
path: 'config',
@ -81,6 +81,7 @@ export class ConfigurableController {
};
}
@Public()
@Post('/upload-files')
@UseInterceptors(
FileInterceptor('file', {

View File

@ -17,11 +17,13 @@ export class COA extends BaseModel {
amount: number;
@Column({
type: 'uuid',
nullable: true,
})
user: string;
@Column({
type: 'uuid',
nullable: true,
})
relatedUser: string;

View File

@ -19,4 +19,6 @@ export class Supplier extends BaseModel {
status: boolean;
coa: COA;
coa_undistribute: COA;
}

View File

@ -139,7 +139,13 @@ export class SupplierService {
'coa',
`coa.supplier = supplier.id and coa.type = '2'`,
)
.select(['supplier', 'coa.amount']);
.leftJoinAndMapOne(
'supplier.coa_undistribute',
COA,
'coa_undistribute',
`coa_undistribute.supplier = supplier.id and coa_undistribute.type = '9'`,
)
.select(['supplier', 'coa.amount', 'coa_undistribute.amount']);
const data = await baseQuery
.skip(page * 10)

View File

@ -126,6 +126,12 @@ export class UsersService {
'user_detail',
`user_detail.user = user.id`,
)
.leftJoinAndMapOne(
'user.coa',
COA,
'coa',
`coa.user = user.id and coa.type = '0'`,
)
.select([
'user.id',
'user.username',
@ -133,6 +139,7 @@ export class UsersService {
'roles.id',
'roles.name',
'user_detail',
'coa.amount',
]);
const data = await baseQuery
@ -175,6 +182,12 @@ export class UsersService {
'user_detail',
`user_detail.user = user.id`,
)
.leftJoinAndMapOne(
'user.coa',
COA,
'coa',
`coa.user = user.id and coa.type = '0'`,
)
.select([
'user.id',
'user.username',
@ -182,6 +195,7 @@ export class UsersService {
'roles.id',
'roles.name',
'user_detail',
'coa.amount',
]);
const data = await baseQuery