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:48 +00:00
commit 99140f85e8
6 changed files with 35 additions and 10 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -139,7 +139,13 @@ export class SupplierService {
'coa', 'coa',
`coa.supplier = supplier.id and coa.type = '2'`, `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 const data = await baseQuery
.skip(page * 10) .skip(page * 10)

View File

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