Alterado end point api/v1/delivery/schedule para mostrar a capacidade e saldo da capacidade com 3 casas decimais e criado peso adicional para mostrar a data de entrega na abertura da venda

This commit is contained in:
eduardoestevao-appsoluti
2025-03-11 17:16:05 -03:00
parent 62f4c767dd
commit 0936c239b9
180 changed files with 18502 additions and 18441 deletions

View File

@@ -1,84 +1,84 @@
import { ResultModel } from '../../domain/models/result.model';
import { DictionaryModel } from '../../domain/models/dictionary.model';
import { EstAbreviatura } from 'src/domain/entity/tables/estabreviatura.entity';
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository, getConnection } from 'typeorm';
import { NumberUtils } from 'src/utils/number.utils';
@Injectable()
export class DictionaryService {
constructor(
@InjectRepository(EstAbreviatura)
private dictionaryRepository: Repository<EstAbreviatura>
) { }
async findAll(): Promise<EstAbreviatura[]> {
return await this.dictionaryRepository.find();
}
async findByDescription(description: string): Promise<EstAbreviatura[]> {
return await this.dictionaryRepository
.createQueryBuilder("estabreviatura")
.where("PALAVRA LIKE UPPER(:description)||'%'", { description }
).getMany();
}
async find(id: number): Promise<EstAbreviatura> {
return await this.dictionaryRepository.createQueryBuilder("estabreviatura").where(
"ID = :id", { id: id }
).getOne();
}
async update(id: number, dados: DictionaryModel) {
return await this.dictionaryRepository
.createQueryBuilder()
.update(EstAbreviatura)
.set({ abreviatura: dados.nick, palavra: dados.word })
.where("ID = :id", { id })
.execute();
}
async delete(id: number) {
return await getConnection()
.createQueryBuilder()
.delete()
.from(EstAbreviatura)
.where("ID = :id", { id })
.execute();
}
async create(dados: DictionaryModel) {
try
{
const id = NumberUtils.getNewId(9999, 1);
const newDictionary = new EstAbreviatura();
newDictionary.id = id;
newDictionary.abreviatura = dados.nick;
newDictionary.palavra = dados.word;
await getConnection()
.createQueryBuilder()
.insert()
.into(EstAbreviatura)
.values(newDictionary)
.execute();
return newDictionary;
} catch ( erro ) {
return new ResultModel(true, "Ops! Houve um erro ao criar o Dicionário.", null, erro);
}
}
import { ResultModel } from '../../domain/models/result.model';
import { DictionaryModel } from '../../domain/models/dictionary.model';
import { EstAbreviatura } from 'src/domain/entity/tables/estabreviatura.entity';
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository, getConnection } from 'typeorm';
import { NumberUtils } from 'src/utils/number.utils';
@Injectable()
export class DictionaryService {
constructor(
@InjectRepository(EstAbreviatura)
private dictionaryRepository: Repository<EstAbreviatura>
) { }
async findAll(): Promise<EstAbreviatura[]> {
return await this.dictionaryRepository.find();
}
async findByDescription(description: string): Promise<EstAbreviatura[]> {
return await this.dictionaryRepository
.createQueryBuilder("estabreviatura")
.where("PALAVRA LIKE UPPER(:description)||'%'", { description }
).getMany();
}
async find(id: number): Promise<EstAbreviatura> {
return await this.dictionaryRepository.createQueryBuilder("estabreviatura").where(
"ID = :id", { id: id }
).getOne();
}
async update(id: number, dados: DictionaryModel) {
return await this.dictionaryRepository
.createQueryBuilder()
.update(EstAbreviatura)
.set({ abreviatura: dados.nick, palavra: dados.word })
.where("ID = :id", { id })
.execute();
}
async delete(id: number) {
return await getConnection()
.createQueryBuilder()
.delete()
.from(EstAbreviatura)
.where("ID = :id", { id })
.execute();
}
async create(dados: DictionaryModel) {
try
{
const id = NumberUtils.getNewId(9999, 1);
const newDictionary = new EstAbreviatura();
newDictionary.id = id;
newDictionary.abreviatura = dados.nick;
newDictionary.palavra = dados.word;
await getConnection()
.createQueryBuilder()
.insert()
.into(EstAbreviatura)
.values(newDictionary)
.execute();
return newDictionary;
} catch ( erro ) {
return new ResultModel(true, "Ops! Houve um erro ao criar o Dicionário.", null, erro);
}
}
}