-
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.
- Loading branch information
1 parent
7fd95a4
commit e48a4bd
Showing
823 changed files
with
2,808 additions
and
109,366 deletions.
There are no files selected for viewing
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Controller, Get, Post, Put, Delete, Body, Param, UseGuards, Query, UploadedFile, UseInterceptors, Res, HttpException, HttpStatus, BadRequestException } from '@nestjs/common'; | ||
import { JwtAuthGuard } from '../auth/jwt-auth.guard'; | ||
import { LoanService } from './loan.service'; | ||
import { Loan } from './loan.model'; | ||
import { FileInterceptor } from '@nestjs/platform-express'; | ||
import * as multer from 'multer'; | ||
import { Response } from 'express'; | ||
import { CreateLoanDto } from './loan.dto'; | ||
|
||
export class TemplateQueryDto { | ||
// @IsOptional() | ||
// @IsString() | ||
format?: string; // Contoh opsi tambahan, misalnya format file (xls/xlsx) | ||
} | ||
|
||
@Controller('loan') | ||
@UseGuards(JwtAuthGuard) | ||
export class LoanController { | ||
constructor(private readonly loanService: LoanService) {} | ||
|
||
@Post() | ||
async create(@Body() createLoanDto: CreateLoanDto) { | ||
return await this.loanService.createLoan(createLoanDto); | ||
} | ||
|
||
} | ||
|
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,10 @@ | ||
export class CreateLoanDto { | ||
user_id: number; | ||
customer_name: string; | ||
notes: string; | ||
assets: { | ||
asset_id: number; | ||
input_method: string; | ||
quantity: number; | ||
}[]; | ||
} |
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,24 @@ | ||
import { Table, Column, Model, DataType, HasMany } from 'sequelize-typescript'; | ||
import { LoanAsset } from 'src/loanAsset/loanAsset.model'; | ||
|
||
// @Table | ||
@Table({ | ||
tableName: 'loan', | ||
timestamps: false // Menonaktifkan createdAt dan updatedAt | ||
}) | ||
export class Loan extends Model<Loan> { | ||
@Column({ type: DataType.INTEGER, primaryKey: true, autoIncrement: true }) | ||
loan_id: number; | ||
|
||
@Column({ type: DataType.INTEGER, allowNull: false }) | ||
user_id: number; | ||
|
||
@Column({ type: DataType.STRING, allowNull: false }) | ||
customer_name: string; | ||
|
||
@Column({ type: DataType.STRING, allowNull: false }) | ||
notes: string; | ||
|
||
@HasMany(() => LoanAsset) | ||
loanAsset: LoanAsset[]; | ||
} |
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,15 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { SequelizeModule } from '@nestjs/sequelize'; | ||
import { LoanController } from './loan.controller'; | ||
import { LoanService } from './loan.service'; | ||
import { Loan } from './loan.model'; | ||
import { LoanAsset } from 'src/loanAsset/loanAsset.model'; | ||
|
||
|
||
@Module({ | ||
imports: [SequelizeModule.forFeature([Loan, LoanAsset])], | ||
controllers: [LoanController], | ||
providers: [LoanService], | ||
exports: [LoanService], | ||
}) | ||
export class LoanModule {} |
Oops, something went wrong.