Compare commits

..

39 Commits

Author SHA1 Message Date
JuruSysadmin 70f35270ad fix: resolve merge conflict in calculateDeliveryTaxOrder
Deploy NestJS API / build-and-push-deploy (push) Failing after 26s Details
2026-01-13 12:57:22 -03:00
JuruSysadmin 73c460d87b Merge branch 'dev' into main
Deploy NestJS API / build-and-push-deploy (push) Failing after 1m36s Details
2026-01-13 12:33:19 -03:00
JuruSysadmin b9525b036e Merge branch 'feat/painel-cliente' 2026-01-13 12:30:02 -03:00
Felipe Batista 15d8fecf42 teste2
Deploy NestJS API / build-and-push-deploy (push) Successful in 41s Details
2026-01-10 11:52:42 -03:00
Felipe Batista c5f284023a teste
Deploy NestJS API / build-and-push-deploy (push) Has been cancelled Details
2026-01-10 11:49:31 -03:00
joelson df466ddaba fix: update server port from 8065 to 8068
Deploy NestJS API / build-and-push-deploy (push) Successful in 4m29s Details
2026-01-09 09:27:19 -03:00
joelson 6360675ebf teste
Deploy NestJS API / build-and-push-deploy (push) Successful in 4m41s Details
2026-01-08 19:41:28 -03:00
joelson cedcb43939 :ajuste na porta para 8065
Deploy NestJS API / build-and-push-deploy (push) Successful in 4m33s Details
2026-01-08 19:03:00 -03:00
joelson b330910fbf feat: ajustado a entidade cliente
Deploy NestJS API / build-and-push-deploy (push) Successful in 3m44s Details
2026-01-08 18:53:59 -03:00
joelson 94f9208ee4 Refactor code structure for improved readability and maintainability
Deploy NestJS API / build-and-push-deploy (push) Failing after 1m34s Details
2026-01-08 18:43:22 -03:00
joelson 4e926909b8 fix: update health check status message to 'TESTE COM ALESSANDRO'
Deploy NestJS API / build-and-push-deploy (push) Successful in 3m40s Details
2026-01-06 12:26:43 -03:00
joelson 70e88913f5 refactor: simplify image tagging and pushing in deployment workflow
Deploy NestJS API / build-and-push-deploy (push) Successful in 2m8s Details
2026-01-06 12:23:33 -03:00
joelson 217329adef Merge branch 'main' of https://git.jurunense.com/joelson/vendaweb-api
Deploy NestJS API / build-and-push-deploy (push) Has been cancelled Details
2026-01-06 12:22:29 -03:00
joelson f55d0da72d refactor: update port mappings to 8068, enhance deployment configurations, and modify health check response 2026-01-06 12:20:43 -03:00
JuruSysadmin 2b91449137 fix: update health check status message to 'JURUNENSE HOME CENTER BR V2'
Deploy NestJS API / build-and-push-deploy (push) Successful in 2m42s Details
2026-01-06 11:18:19 -03:00
JuruSysadmin 95850ea39b fix: update health check status message to 'JURUNENSE HOME CENTER BR'
Deploy NestJS API / build-and-push-deploy (push) Successful in 2m48s Details
2026-01-06 11:07:03 -03:00
JuruSysadmin 1760934db3 fix: update health check response status message to 'JURUNENSE HOME CENTER'
Deploy NestJS API / build-and-push-deploy (push) Successful in 2m42s Details
2026-01-06 10:59:26 -03:00
JuruSysadmin 7b2f13ab91 fix: update health check status response to ':ok 4'
Deploy NestJS API / build-and-push-deploy (push) Successful in 2m51s Details
2026-01-06 10:52:49 -03:00
joelson f66fd4271f :ok
Deploy NestJS API / build-and-push-deploy (push) Successful in 2m45s Details
2026-01-05 15:50:31 -03:00
joelson c60eabd804 feat: Configure host-mode port mapping and a stop-first deployment strategy with rollback, removing local build.
Deploy NestJS API / build-and-push-deploy (push) Successful in 3m1s Details
2026-01-05 15:39:49 -03:00
joelson 9176d65606 refactor: Update workflow name, SHA source, Docker image tagging, and Portainer webhook notification.
Deploy NestJS API / build-and-push-deploy (push) Successful in 30s Details
2026-01-05 15:23:32 -03:00
joelson 1fa2938128 fix: remove accidental '7' character from WEBHOOK_URL secret definition in deploy workflow 2026-01-05 15:11:25 -03:00
joelson efc7d738a9 refactor: streamline Docker build/push and add webhook secret validation to deployment workflow.
Deploy vendaweb-api / build-and-push-deploy (push) Successful in 29s Details
2026-01-05 15:09:22 -03:00
joelson bf246e2882 chore: update API startup console log message
Deploy vendaweb-api / build-and-push-deploy (push) Successful in 1m2s Details
2026-01-05 14:56:17 -03:00
joelson fb724067c8 style: adjust whitespace in getVersion method
Deploy vendaweb-api / build-and-push-deploy (push) Successful in 3m14s Details
2026-01-05 14:50:27 -03:00
joelson e9c7d8d282 chore: Update health check endpoint status message.
Deploy vendaweb-api / build-and-push-deploy (push) Successful in 3m7s Details
2026-01-05 14:43:23 -03:00
joelson a92fa77e37 feat: Configure `vendaweb-api` service to build locally and connect to an external `juru-network`.
Deploy vendaweb-api / build-and-push-deploy (push) Successful in 3m39s Details
2026-01-05 14:34:15 -03:00
joelson e6fd33a22e fix: remove unused networks section from docker-compose.yml
Deploy vendaweb-api / build-and-push-deploy (push) Successful in 30s Details
2026-01-05 14:23:33 -03:00
joelson c75f8ed9f4 fix: comment out networks section in docker-compose.yml
Deploy vendaweb-api / build-and-push-deploy (push) Successful in 32s Details
2026-01-05 14:21:22 -03:00
joelson b034330e34 fix: add console log to indicate API is running on port 8066
Deploy vendaweb-api / build-and-push-deploy (push) Successful in 2m44s Details
2026-01-05 14:05:40 -03:00
joelson 61cdae600c fix: ensure server listens on all network interfaces in main.ts 2026-01-05 14:05:14 -03:00
joelson 6fe94a4a7c refactor: clean up Dockerfile by removing unnecessary comments and consolidating commands
Deploy vendaweb-api / build-and-push-deploy (push) Successful in 2m46s Details
2026-01-05 14:00:11 -03:00
joelson 0084a162f7 fix: correct port mapping in docker-compose.yml for vendaweb-api
Deploy vendaweb-api / build-and-push-deploy (push) Successful in 46s Details
2026-01-05 13:55:49 -03:00
joelson d5fa17151f fix: update Dockerfile CMD and change server port in main.ts
Deploy vendaweb-api / build-and-push-deploy (push) Successful in 50s Details
2026-01-05 13:29:57 -03:00
joelson 937b3f37ab fix: update vendaweb-api configuration in docker-compose.yml 2026-01-05 13:29:49 -03:00
joelson 7022d491ce feat: add deployment workflow for vendaweb-api
Deploy vendaweb-api / build-and-push-deploy (push) Failing after 1m19s Details
2026-01-05 12:12:54 -03:00
joelson c4e8996a22 feat: add deployment workflow for vendaweb-api 2026-01-05 12:00:48 -03:00
juru 757d547755 chore: ignora pastas de dados e arquivos sensiveis 2026-01-05 11:46:41 -03:00
juru 79fb04fdb5 first commit 2026-01-05 11:45:17 -03:00
10 changed files with 139 additions and 148 deletions

View File

@ -0,0 +1,30 @@
name: Deploy NestJS API
on: [push]
jobs:
build-and-push-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login no Harbor
run: |
echo "${{ secrets.HARBOR_PASSWORD }}" | docker login 10.1.1.124:8082 -u ${{ secrets.HARBOR_USERNAME }} --password-stdin
- name: Build e Push
run: |
# Usando o short SHA para uma tag mais limpa
TAG=$(echo ${{ gitea.sha }} | cut -c1-7)
IMAGE_NAME="10.1.1.124:8082/library/vendaweb-api"
docker build -t $IMAGE_NAME:$TAG .
docker tag $IMAGE_NAME:$TAG $IMAGE_NAME:latest
docker push $IMAGE_NAME:$TAG
docker push $IMAGE_NAME:latest
- name: Notificar Portainer via Webhook
run: |
# O segredo PORTAINER_WEBHOOK_VENDAWEBAPI deve conter a URL completa gerada na Stack
curl -f -X POST "${{ secrets.PORTAINER_WEBHOOK_VENDAWEBAPI }}"

2
.gitignore vendored
View File

@ -33,3 +33,5 @@ lerna-debug.log*
!.vscode/launch.json !.vscode/launch.json
!.vscode/extensions.json !.vscode/extensions.json
postgres-data/
.env

View File

@ -1,32 +1,24 @@
FROM node:16 FROM node:16-bullseye-slim AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install --legacy-peer-deps
COPY . .
RUN npm run build
FROM node:16-bullseye-slim
RUN apt-get update && apt-get install -y libaio1 unzip wget && mkdir -p /opt/oracle
RUN apt-get update && apt-get install -y \ RUN wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linuxx64.zip -O /opt/oracle/client.zip && \
apt-transport-https \ unzip /opt/oracle/client.zip -d /opt/oracle && \
ca-certificates \ rm /opt/oracle/client.zip && \
libaio1 \ ln -s /opt/oracle/instantclient_* /opt/oracle/instantclient
unzip \
wget \
libc6 \
libncurses5 && \
mkdir -p /opt/oracle && \
wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linuxx64.zip -O /opt/oracle/instantclient-basic-linuxx64.zip && \
unzip /opt/oracle/instantclient-basic-linuxx64.zip -d /opt/oracle && \
rm /opt/oracle/instantclient-basic-linuxx64.zip && \
ln -s /opt/oracle/instantclient_* /opt/oracle/instantclient && \
echo "/opt/oracle/instantclient" > /etc/ld.so.conf.d/oracle-instantclient.conf && \
ldconfig
ENV LD_LIBRARY_PATH=/opt/oracle/instantclient
WORKDIR /app WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/node_modules ./node_modules
COPY package*.json ./ EXPOSE 8068
RUN npm install --legacy-peer-deps
COPY . .
CMD ["npm", "run", "start:prod"] CMD ["npm", "run", "start:prod"]

View File

@ -1,14 +1,18 @@
version: '3.8' version: '3.8'
services: services:
vendaweb: vendaweb-api:
image: link70/vendaweb image: 10.1.1.124:8082/library/vendaweb-api:latest
deploy:
replicas: 20
resources:
limits:
cpus: '0.5'
memory: 512M
ports: ports:
- "8065:8065" - "8068:8068"
restart: always networks:
- simplifique-network
deploy:
replicas: 4
update_config:
order: start-first
parallelism: 1
networks:
simplifique-network:
external: true

View File

@ -1,5 +1,5 @@
import { Controller, Get } from '@nestjs/common'; import { Controller, Get } from '@nestjs/common';
import { ApiTags, ApiOperation } from '@nestjs/swagger'; import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { APP_VERSION } from './version'; import { APP_VERSION } from './version';
@ApiTags('Main') @ApiTags('Main')
@ -11,10 +11,10 @@ export class AppController {
return { version: APP_VERSION }; return { version: APP_VERSION };
} }
@Get('health') @Get('health')
@ApiOperation({ summary: 'Health check' }) @ApiOperation({ summary: 'Health check' })
healthCheck() { healthCheck() {
return { status: 'ok' }; return { status: 'TESTE COM Felipe2 ' };
} }
} }

View File

@ -2,17 +2,17 @@ import { TypeOrmModuleOptions } from '@nestjs/typeorm';
import { ConnectionOptions } from 'typeorm'; import { ConnectionOptions } from 'typeorm';
export const typeOrmConfig: TypeOrmModuleOptions = { export const typeOrmConfig: TypeOrmModuleOptions = {
type: 'oracle', type: "oracle",
// host: "192.168.100.40", // host: "192.168.100.40",
// username: "LIVIA", // username: "LIVIA",
// password: "LIVIA", // password: "LIVIA",
host: '10.1.1.241', host: "10.1.1.241",
username: 'SEVEN', username: "SEVEN",
password: 'USR54SEV', password: "USR54SEV",
// username: "API", // username: "API",
// password: "E05H5KIEQV3YKDJR", // password: "E05H5KIEQV3YKDJR",
port: 1521, port: 1521,
serviceName: 'WINT', sid: "WINT",
synchronize: false, synchronize: false,
logging: false, logging: false,
entities: [__dirname + '/../**/*.entity.{js,ts}'], entities: [__dirname + '/../**/*.entity.{js,ts}'],
@ -20,12 +20,12 @@ export const typeOrmConfig: TypeOrmModuleOptions = {
}; };
export const connectionOptions: ConnectionOptions = { export const connectionOptions: ConnectionOptions = {
type: 'oracle', type: "oracle",
host: '10.1.1.241', host: "10.1.1.241",
username: 'SEVEN', username: "SEVEN",
password: 'USR54SEV', password: "USR54SEV",
port: 1521, port: 1521,
serviceName: 'WINT', sid: "WINT",
synchronize: false, synchronize: false,
logging: false, logging: false,
entities: [__dirname + '/../**/*.entity.{js,ts}'], entities: [__dirname + '/../**/*.entity.{js,ts}'],

View File

@ -20,6 +20,6 @@ async function bootstrap() {
.build(); .build();
const document = SwaggerModule.createDocument(app, options); const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup("docs", app, document); SwaggerModule.setup("docs", app, document);
await app.listen(8065); await app.listen(8068, '0.0.0.0');}
} console.log('API rodando na porta 8065 test 4');
bootstrap(); bootstrap();

View File

@ -132,17 +132,15 @@ export class CustomerController {
} }
@Post('create') @Post('create')
async createCustomer(@Body() customer: Customer) { async createCustomer(@Body() customer: Customer){
try { try{
console.log(customer); console.log(customer);
const result = await this.customerService.createCustomer(customer); const result = await this.customerService.createCustomer(customer);
return new ResultModel(true, null, result, null); return new ResultModel(true, null, result, null);
//return new ResultModel(true, null, id, null); //return new ResultModel(true, null, id, null);
} catch (err) { } catch(err){
throw new HttpException( throw new HttpException(new ResultModel(false, 'Erro ao cadastrar cliente.', {}, err),
new ResultModel(false, 'Erro ao cadastrar cliente.', {}, err), HttpStatus.INTERNAL_SERVER_ERROR);
HttpStatus.INTERNAL_SERVER_ERROR,
);
} }
} }
} }

View File

@ -367,66 +367,37 @@ export class CustomerService {
await this.updateCustomer(newCustomer); await this.updateCustomer(newCustomer);
return { return {
customerId: oldCustomer.customerId, customerId: oldCustomer.customerId,
company: customer.company, company: customer.company, name: customer.name, sexo: customer.gender,
name: customer.name, cpfCnpj: customer.cpfCnpj, numberState: customer.numberState,
sexo: customer.gender, email: customer.email, zipCode: customer.zipCode, address: customer.address,
cpfCnpj: customer.cpfCnpj, addressNumber: customer.addressNumber, complement: customer.complement,
numberState: customer.numberState,
email: customer.email,
zipCode: customer.zipCode,
address: customer.address,
addressNumber: customer.addressNumber,
complement: customer.complement,
neighborhood: customer.neighborhood, neighborhood: customer.neighborhood,
city: customer.city, city: customer.city, state: customer.state,
state: customer.state, allowMessage: customer.allowMessage, cellPhone: customer.cellPhone,
allowMessage: customer.allowMessage, category: customer.category, subCategory: customer.subCategory,
cellPhone: customer.cellPhone, place: customer.place, ramo: customer.ramo, meiocomunicacao: customer.communicate,
category: customer.category, latitude: customer.latitude, longitude: customer.longitude, ibgeCode: customer.ibgeCode,
subCategory: customer.subCategory,
place: customer.place,
ramo: customer.ramo,
meiocomunicacao: customer.communicate,
latitude: customer.latitude,
longitude: customer.longitude,
ibgeCode: customer.ibgeCode,
addressType: customer.addressType, addressType: customer.addressType,
}; };
} else { } else {
const idCustomer = await this.generateIdCustomer(); const idCustomer = await this.generateIdCustomer();
if (idCustomer == -1) if (idCustomer == -1)
return new HttpException( return new HttpException("Erro ao gerar númeração de cliente.", HttpStatus.INTERNAL_SERVER_ERROR);
'Erro ao gerar númeração de cliente.',
HttpStatus.INTERNAL_SERVER_ERROR,
);
newCustomer.codcli = idCustomer; newCustomer.codcli = idCustomer;
await this.insertCustomer(newCustomer); await this.insertCustomer(newCustomer);
return { return {
customerId: idCustomer, customerId: idCustomer,
company: customer.company, company: customer.company, name: customer.name,
name: customer.name, cpfCnpj: customer.cpfCnpj, gender: customer.gender, numberState: customer.numberState,
cpfCnpj: customer.cpfCnpj, email: customer.email, zipCode: customer.zipCode, address: customer.address,
gender: customer.gender, addressNumber: customer.addressNumber, complement: customer.complement,
numberState: customer.numberState,
email: customer.email,
zipCode: customer.zipCode,
address: customer.address,
addressNumber: customer.addressNumber,
complement: customer.complement,
neighborhood: customer.neighborhood, neighborhood: customer.neighborhood,
city: customer.city, city: customer.city, state: customer.state,
state: customer.state, allowMessage: customer.allowMessage, cellPhone: customer.cellPhone,
allowMessage: customer.allowMessage, category: customer.category, subCategory: customer.subCategory,
cellPhone: customer.cellPhone, place: customer.place, meiocomunicacao: customer.communicate,
category: customer.category, ramo: customer.ramo, latitude: customer.latitude, longitude: customer.longitude,
subCategory: customer.subCategory, ibgeCode: customer.ibgeCode, addressType: customer.addressType,
place: customer.place,
meiocomunicacao: customer.communicate,
ramo: customer.ramo,
latitude: customer.latitude,
longitude: customer.longitude,
ibgeCode: customer.ibgeCode,
addressType: customer.addressType,
}; };
} }
} catch (error) { } catch (error) {

View File

@ -1506,12 +1506,6 @@ export class SalesService {
async calculateDeliveryTaxOrder(dataDeliveryTax: any) { async calculateDeliveryTaxOrder(dataDeliveryTax: any) {
console.log("json dataDeliveryTax", dataDeliveryTax); console.log("json dataDeliveryTax", dataDeliveryTax);
/*const dataDeliveryTax = {
cartId: cartId,
cityId: cityId,
ibgeCode: ibgeCode,
priorityDelivery: priorityDelivery,
};*/
let cityId = 0; let cityId = 0;
if (dataDeliveryTax.ibgeCode) { if (dataDeliveryTax.ibgeCode) {