diff --git a/README.md b/README.md index 6b5968c..474f2c1 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,39 @@
Nest.js & Angular | Cloud-based Web Application for Asset Management
-Current version: V1.0 Branch
+Nest.js & Angular SSR | Cloud-based Web Application for Asset Management
+Current version: V1.5 Branch
+Next version function: Unit test and Excel Data Export
+If you find this project helpful, please click ⭐ Star! This helps more people discover it.
This is a full-stack Fixed Asset Management System built with Spring Boot and Vue.js, designed for managing fixed assets within facilities. The system includes:
+This is a full-stack Fixed Asset Management System built with Nest.js and Angular SSR, designed for managing fixed assets within facilities. The system includes:
The system is cloud-based, significantly reducing IT infrastructure costs and improving usability, with no installation required.
- + +
+
+
+
+
+
+
+
A progressive Node.js framework for building efficient and scalable server-side applications.
- - - -## Description - -[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. - -## Project setup - -```bash -$ yarn install -``` - -## Compile and run the project - -```bash -# development -$ yarn run start - -# watch mode -$ yarn run start:dev - -# production mode -$ yarn run start:prod -``` - -## Run tests - -```bash -# unit tests -$ yarn run test - -# e2e tests -$ yarn run test:e2e - -# test coverage -$ yarn run test:cov -``` - -## Deployment - -When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information. - -If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps: - -```bash -$ yarn install -g mau -$ mau deploy -``` - -With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure. - -## Resources - -Check out a few resources that may come in handy when working with NestJS: - -- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework. -- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy). -- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/). -- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks. -- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com). -- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com). -- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs). -- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com). - -## Support - -Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). - -## Stay in touch - -- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec) -- Website - [https://nestjs.com](https://nestjs.com/) -- Twitter - [@nestframework](https://twitter.com/nestframework) - -## License - -Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE). diff --git a/backend/src/app.controller.ts b/backend/src/app.controller.ts index cce879e..df6065b 100644 --- a/backend/src/app.controller.ts +++ b/backend/src/app.controller.ts @@ -5,8 +5,8 @@ import { AppService } from './app.service'; export class AppController { constructor(private readonly appService: AppService) {} - @Get() + /* @Get() getHello(): string { return this.appService.getHello(); - } + } */ } diff --git a/backend/src/app.module.ts b/backend/src/app.module.ts index 26ed04a..5eab8f7 100644 --- a/backend/src/app.module.ts +++ b/backend/src/app.module.ts @@ -24,6 +24,8 @@ import { WriteOffModule } from './module/write-off/write-off.module' import { SysMenuMoudule } from './module/sys-menu/sys-menu.module' import { RepairRecordMoudule } from './module/repair-record/repair-record.module' import { StockTakeMoudule } from './module/stock-take/stcok-take.module' +import { ExcelFieldMatchModule } from './module/excelFieldMatch/excelFieldMatch.module' +import { SysUserSchema } from './module/sys-user/sysUser.schame' @Module({ imports: [ @@ -44,10 +46,12 @@ import { StockTakeMoudule } from './module/stock-take/stcok-take.module' SysRoleMoudule, SysUserMoudule, SysMenuMoudule, + ExcelFieldMatchModule, MongooseModule.forRoot('mongodb://localhost/fixedasset'), MongooseModule.forFeature([ { name: 'SysRoles', schema: SysRoleSchema }, - { name: 'Department', schema: DepartmentSchema } + { name: 'Department', schema: DepartmentSchema }, + { name: 'SysUser', schema: SysUserSchema } ]) ], controllers: [AppController], diff --git a/backend/src/module/InvRecord/InvRecord.controller.ts b/backend/src/module/InvRecord/InvRecord.controller.ts index 5460d84..99ceabe 100644 --- a/backend/src/module/InvRecord/InvRecord.controller.ts +++ b/backend/src/module/InvRecord/InvRecord.controller.ts @@ -1,11 +1,15 @@ import { Body, Controller, Post } from '@nestjs/common' import { InvRecordService } from './InvRecord.service' -import { ListRecordReqDto } from './InvRecord.dto' +import { ListInvRecordResponse, ListRecordReqBody, ListRecordReqDto } from './InvRecord.dto' +import { ApiBody, ApiOperation, ApiResponse } from '@nestjs/swagger' @Controller('sys/inv-record') export class InvRecordController { constructor(private invReocrdService: InvRecordService) {} + @ApiOperation({ summary: 'Page and list'}) + @ApiBody({ type: ListRecordReqBody }) + @ApiResponse({ description: 'If successful', status: 201, type: ListInvRecordResponse }) @Post('list') async list(@Body() query: ListRecordReqDto) { return await this.invReocrdService.listRecord(query) diff --git a/backend/src/module/InvRecord/InvRecord.dto.ts b/backend/src/module/InvRecord/InvRecord.dto.ts index 85a6755..9755882 100644 --- a/backend/src/module/InvRecord/InvRecord.dto.ts +++ b/backend/src/module/InvRecord/InvRecord.dto.ts @@ -1,3 +1,9 @@ +import { ApiProperty } from "@nestjs/swagger" +import { AssetListBody } from "../asset-list/asset-list.dto" +import { LocationBody } from "../location/location.dto" +import { CommonPageAndList, CommonPageAndListResponse } from "src/tool/open-api-body" +import { IsOptional } from "@nestjs/class-validator" + export interface CreateInvRecordDto { assetCode: string placeFrom: string @@ -9,4 +15,45 @@ export interface ListRecordReqDto { limit: number assetCode?: string dateRange?: string[] +} + +export class InvRecordBody { + @ApiProperty({ description: 'Data Id' }) + _id: string + + @ApiProperty({ description: 'Asset Code' }) + assetCode: string + + @ApiProperty({ description: 'Place From Id' }) + placeFrom: string + + @ApiProperty({ description: 'Place To Id' }) + placeTo: string + + @ApiProperty({ description: 'Created At' }) + createdAt: string + + @ApiProperty({ description: 'Asset List Data', type: AssetListBody }) + assetList: AssetListBody + + @ApiProperty({ description: 'Place From Date', type: LocationBody }) + placeFromData: LocationBody + + @ApiProperty({ description: 'Place To Date', type: LocationBody }) + placeToData: LocationBody +} + +export class ListRecordReqBody extends CommonPageAndList { + @ApiProperty({ description: 'Asset Code' }) + @IsOptional() + assetCode: string + + @ApiProperty({ description: 'Date Range', isArray: true }) + @IsOptional() + dateRange: string[] +} + +export class ListInvRecordResponse extends CommonPageAndListResponse { + @ApiProperty({ description: 'Data List', type: InvRecordBody, isArray: true }) + data: InvRecordBody[] } \ No newline at end of file diff --git a/backend/src/module/InvRecord/InvRecord.service.ts b/backend/src/module/InvRecord/InvRecord.service.ts index 7e28559..b76a3f8 100644 --- a/backend/src/module/InvRecord/InvRecord.service.ts +++ b/backend/src/module/InvRecord/InvRecord.service.ts @@ -79,7 +79,7 @@ export class InvRecordService { { $limit: limit }, ]).exec() - const total = await this.invRecordModel.find(finalFilter).countDocuments() + const total = await this.invRecordModel.find(finalFilter).countDocuments().exec() return { total, diff --git a/backend/src/module/action-record/actionRecord.controller.spec.ts b/backend/src/module/action-record/actionRecord.controller.spec.ts new file mode 100644 index 0000000..1a90034 --- /dev/null +++ b/backend/src/module/action-record/actionRecord.controller.spec.ts @@ -0,0 +1,108 @@ +import { Test, TestingModule } from '@nestjs/testing' +import { ActionRecordController } from './actionRecord.controller' +import { ActionRecordService } from './actionRecord.service' +import { AuthGuard } from '../auth/AuthGuard' +import { ActionRecord, ActionRecordSchema } from './actionRecord.schame' +import { Model } from 'mongoose' +import { getModelToken } from '@nestjs/mongoose' + +describe('ActionRecordController', () => { + let controller: ActionRecordController + let service: ActionRecordService + + const mockActionRecordService = { + listAndPage: jest.fn() + } + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + controllers: [ActionRecordController], + providers: [ + { + provide: ActionRecordService, + useValue: mockActionRecordService, + }, + ], + }) + .overrideGuard(AuthGuard) + .useValue({ canActivate: jest.fn(() => true) }) + .compile(); + + controller = module.getClick or drag file to this area to upload
++ Support for a single or bulk upload. Strictly prohibit from uploading company data or other band files +
+