-
Notifications
You must be signed in to change notification settings - Fork 4
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
Showing
29 changed files
with
309 additions
and
28 deletions.
There are no files selected for viewing
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
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
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 @@ | ||
export class CreateLicenceDto {} |
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,4 @@ | ||
import { PartialType } from '@nestjs/swagger'; | ||
import { CreateLicenceDto } from './create-licence.dto'; | ||
|
||
export class UpdateLicenceDto extends PartialType(CreateLicenceDto) {} |
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,28 @@ | ||
import { IsNotEmpty } from 'class-validator'; | ||
import { Entity, Column, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'; | ||
import { User } from '../../user/entities/user.entity'; | ||
|
||
@Entity() | ||
export class Licence { | ||
@PrimaryGeneratedColumn() | ||
id: number; | ||
|
||
@ManyToOne(() => User, (user) => user.id, { | ||
nullable: false, | ||
}) | ||
@JoinColumn({ name: 'codUser' }) | ||
@Column() | ||
codUser: number; | ||
|
||
@Column({ type: 'text', nullable: false }) | ||
@IsNotEmpty() | ||
description: string; | ||
|
||
@Column({ type: 'date', nullable: false }) | ||
@IsNotEmpty() | ||
dateInit: Date; | ||
|
||
@Column({ type: 'date', nullable: false }) | ||
@IsNotEmpty() | ||
dateEnd: Date; | ||
} |
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,20 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { LicenceController } from './licence.controller'; | ||
import { LicenceService } from './licence.service'; | ||
|
||
describe('LicenceController', () => { | ||
let controller: LicenceController; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
controllers: [LicenceController], | ||
providers: [LicenceService], | ||
}).compile(); | ||
|
||
controller = module.get<LicenceController>(LicenceController); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(controller).toBeDefined(); | ||
}); | ||
}); |
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,34 @@ | ||
import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'; | ||
import { LicenceService } from './licence.service'; | ||
import { CreateLicenceDto } from './dto/create-licence.dto'; | ||
import { UpdateLicenceDto } from './dto/update-licence.dto'; | ||
|
||
@Controller('licence') | ||
export class LicenceController { | ||
constructor(private readonly licenceService: LicenceService) {} | ||
|
||
@Post() | ||
create(@Body() createLicenceDto: CreateLicenceDto) { | ||
return this.licenceService.create(createLicenceDto); | ||
} | ||
|
||
@Get() | ||
findAll() { | ||
return this.licenceService.findAll(); | ||
} | ||
|
||
@Get(':id') | ||
findOne(@Param('id') id: string) { | ||
return this.licenceService.findOne(+id); | ||
} | ||
|
||
@Patch(':id') | ||
update(@Param('id') id: string, @Body() updateLicenceDto: UpdateLicenceDto) { | ||
return this.licenceService.update(+id, updateLicenceDto); | ||
} | ||
|
||
@Delete(':id') | ||
remove(@Param('id') id: string) { | ||
return this.licenceService.remove(+id); | ||
} | ||
} |
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,13 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { LicenceService } from './licence.service'; | ||
import { LicenceController } from './licence.controller'; | ||
import { Licence } from './entities/licence.entity'; | ||
import { TypeOrmModule } from '@nestjs/typeorm'; | ||
|
||
@Module({ | ||
imports: [TypeOrmModule.forFeature([Licence])], | ||
controllers: [LicenceController], | ||
providers: [LicenceService], | ||
exports: [LicenceService], | ||
}) | ||
export class LicenceModule {} |
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,18 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { LicenceService } from './licence.service'; | ||
|
||
describe('LicenceService', () => { | ||
let service: LicenceService; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [LicenceService], | ||
}).compile(); | ||
|
||
service = module.get<LicenceService>(LicenceService); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(service).toBeDefined(); | ||
}); | ||
}); |
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,26 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { CreateLicenceDto } from './dto/create-licence.dto'; | ||
import { UpdateLicenceDto } from './dto/update-licence.dto'; | ||
|
||
@Injectable() | ||
export class LicenceService { | ||
create(createLicenceDto: CreateLicenceDto) { | ||
return 'This action adds a new licence'; | ||
} | ||
|
||
findAll() { | ||
return `This action returns all licence`; | ||
} | ||
|
||
findOne(id: number) { | ||
return `This action returns a #${id} licence`; | ||
} | ||
|
||
update(id: number, updateLicenceDto: UpdateLicenceDto) { | ||
return `This action updates a #${id} licence`; | ||
} | ||
|
||
remove(id: number) { | ||
return `This action removes a #${id} licence`; | ||
} | ||
} |
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 |
---|---|---|
@@ -1 +1,29 @@ | ||
export class CreateTypeDto {} | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsMilitaryTime, IsNotEmpty, IsString } from 'class-validator'; | ||
|
||
export class CreateTypeDto { | ||
@ApiProperty() | ||
@IsString() | ||
@IsNotEmpty() | ||
description: string; | ||
|
||
@ApiProperty() | ||
@IsString() | ||
@IsNotEmpty() | ||
backgroundColor: string; | ||
|
||
@ApiProperty() | ||
@IsString() | ||
@IsNotEmpty() | ||
borderColor: string; | ||
|
||
@ApiProperty() | ||
@IsMilitaryTime() | ||
@IsNotEmpty() | ||
start: Date; | ||
|
||
@ApiProperty() | ||
@IsMilitaryTime() | ||
@IsNotEmpty() | ||
end: Date; | ||
} |
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 |
---|---|---|
@@ -1,4 +1,9 @@ | ||
import { PartialType } from '@nestjs/swagger'; | ||
import { ApiProperty, PartialType } from '@nestjs/swagger'; | ||
import { IsNotEmpty } from 'class-validator'; | ||
import { CreateTypeDto } from './create-type.dto'; | ||
|
||
export class UpdateTypeDto extends PartialType(CreateTypeDto) {} | ||
export class UpdateTypeDto extends PartialType(CreateTypeDto) { | ||
@ApiProperty() | ||
@IsNotEmpty() | ||
codType: 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
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
Oops, something went wrong.