chore: fmt

This commit is contained in:
Michael Abebe
2026-05-12 16:50:18 +03:00
parent 4540d35215
commit 1c5ee19388
181 changed files with 1492 additions and 1100 deletions

View File

@@ -1,30 +1,37 @@
import { Body, Controller, Get, Param, ParseUUIDPipe, Post } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import {
Body,
Controller,
Get,
Param,
ParseUUIDPipe,
Post,
} from "@nestjs/common";
import { ApiOperation, ApiTags } from "@nestjs/swagger";
import { CustomersService } from './customers.service';
import { CreateCustomerDto } from './dto/create-customer.dto';
import { CustomersService } from "./customers.service";
import { CreateCustomerDto } from "./dto/create-customer.dto";
@ApiTags('customers')
@ApiTags("customers")
// @UseGuards(JwtAuthGuard) — TODO: integrate @edr/auth
@Controller('customers')
@Controller("customers")
export class CustomersController {
constructor(private readonly customersService: CustomersService) {}
@Post()
@ApiOperation({ summary: 'Create a new customer' })
@ApiOperation({ summary: "Create a new customer" })
create(@Body() dto: CreateCustomerDto) {
return this.customersService.create(dto);
}
@Get()
@ApiOperation({ summary: 'List all customers' })
@ApiOperation({ summary: "List all customers" })
findAll() {
return this.customersService.findAll();
}
@Get(':id')
@ApiOperation({ summary: 'Get a customer by ID' })
findOne(@Param('id', ParseUUIDPipe) id: string) {
@Get(":id")
@ApiOperation({ summary: "Get a customer by ID" })
findOne(@Param("id", ParseUUIDPipe) id: string) {
return this.customersService.findById(id);
}
}

View File

@@ -1,10 +1,10 @@
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Module } from "@nestjs/common";
import { TypeOrmModule } from "@nestjs/typeorm";
import { CustomersController } from './customers.controller';
import { CustomersRepository } from './customers.repository';
import { CustomersService } from './customers.service';
import { Customer } from './entities/customer.entity';
import { CustomersController } from "./customers.controller";
import { CustomersRepository } from "./customers.repository";
import { CustomersService } from "./customers.service";
import { Customer } from "./entities/customer.entity";
@Module({
imports: [TypeOrmModule.forFeature([Customer])],

View File

@@ -1,9 +1,9 @@
import { BaseRepository } from '@edr/api-common';
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { BaseRepository } from "@edr/api-common";
import { Injectable } from "@nestjs/common";
import { InjectRepository } from "@nestjs/typeorm";
import { Repository } from "typeorm";
import { Customer } from './entities/customer.entity';
import { Customer } from "./entities/customer.entity";
@Injectable()
export class CustomersRepository extends BaseRepository<Customer> {

View File

@@ -1,8 +1,8 @@
import { Injectable, NotFoundException } from '@nestjs/common';
import { Injectable, NotFoundException } from "@nestjs/common";
import { CustomersRepository } from './customers.repository';
import { CreateCustomerDto } from './dto/create-customer.dto';
import { Customer } from './entities/customer.entity';
import { CustomersRepository } from "./customers.repository";
import { CreateCustomerDto } from "./dto/create-customer.dto";
import { Customer } from "./entities/customer.entity";
@Injectable()
export class CustomersService {
@@ -15,7 +15,7 @@ export class CustomersService {
/** List every customer (alphabetical). */
findAll(): Promise<Customer[]> {
return this.customersRepository.findAll({ order: { name: 'ASC' } });
return this.customersRepository.findAll({ order: { name: "ASC" } });
}
/** Get a single customer by ID. */

View File

@@ -1,4 +1,4 @@
import { IsEmail, IsOptional, IsString } from 'class-validator';
import { IsEmail, IsOptional, IsString } from "class-validator";
export class CreateCustomerDto {
@IsString()

View File

@@ -1,20 +1,20 @@
import { BaseEntity } from '@edr/api-common';
import { Column, Entity } from 'typeorm';
import { BaseEntity } from "@edr/api-common";
import { Column, Entity } from "typeorm";
@Entity({ name: 'customers' })
@Entity({ name: "customers" })
export class Customer extends BaseEntity {
@Column({ name: 'name', type: 'varchar', length: 256 })
@Column({ name: "name", type: "varchar", length: 256 })
name!: string;
@Column({ name: 'email', type: 'varchar', length: 256, unique: true })
@Column({ name: "email", type: "varchar", length: 256, unique: true })
email!: string;
@Column({ name: 'phone', type: 'varchar', length: 32 })
@Column({ name: "phone", type: "varchar", length: 32 })
phone!: string;
@Column({ name: 'address', type: 'text', nullable: true })
@Column({ name: "address", type: "text", nullable: true })
address?: string | null;
@Column({ name: 'tax_id', type: 'varchar', length: 64, nullable: true })
@Column({ name: "tax_id", type: "varchar", length: 64, nullable: true })
taxId?: string | null;
}