Compare commits

..

No commits in common. "main" and "feat/painel-cliente" have entirely different histories.

10 changed files with 149 additions and 140 deletions

View File

@ -1,30 +0,0 @@
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,5 +33,3 @@ lerna-debug.log*
!.vscode/launch.json
!.vscode/extensions.json
postgres-data/
.env

View File

@ -1,24 +1,32 @@
FROM node:16-bullseye-slim AS builder
FROM node:16
RUN apt-get update && apt-get install -y \
apt-transport-https \
ca-certificates \
libaio1 \
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
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 wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linuxx64.zip -O /opt/oracle/client.zip && \
unzip /opt/oracle/client.zip -d /opt/oracle && \
rm /opt/oracle/client.zip && \
ln -s /opt/oracle/instantclient_* /opt/oracle/instantclient
ENV LD_LIBRARY_PATH=/opt/oracle/instantclient
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 8068
CMD ["npm", "run", "start:prod"]

View File

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

View File

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

View File

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

View File

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

View File

@ -139,8 +139,10 @@ export class CustomerController {
return new ResultModel(true, null, result, null);
//return new ResultModel(true, null, id, null);
} catch (err) {
throw new HttpException(new ResultModel(false, 'Erro ao cadastrar cliente.', {}, err),
HttpStatus.INTERNAL_SERVER_ERROR);
throw new HttpException(
new ResultModel(false, 'Erro ao cadastrar cliente.', {}, err),
HttpStatus.INTERNAL_SERVER_ERROR,
);
}
}
}

View File

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

View File

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