Compare commits
38 Commits
feat/paine
...
main
| Author | SHA1 | Date |
|---|---|---|
|
|
73c460d87b | |
|
|
b9525b036e | |
|
|
15d8fecf42 | |
|
|
c5f284023a | |
|
|
df466ddaba | |
|
|
6360675ebf | |
|
|
cedcb43939 | |
|
|
b330910fbf | |
|
|
94f9208ee4 | |
|
|
4e926909b8 | |
|
|
70e88913f5 | |
|
|
217329adef | |
|
|
f55d0da72d | |
|
|
2b91449137 | |
|
|
95850ea39b | |
|
|
1760934db3 | |
|
|
7b2f13ab91 | |
|
|
f66fd4271f | |
|
|
c60eabd804 | |
|
|
9176d65606 | |
|
|
1fa2938128 | |
|
|
efc7d738a9 | |
|
|
bf246e2882 | |
|
|
fb724067c8 | |
|
|
e9c7d8d282 | |
|
|
a92fa77e37 | |
|
|
e6fd33a22e | |
|
|
c75f8ed9f4 | |
|
|
b034330e34 | |
|
|
61cdae600c | |
|
|
6fe94a4a7c | |
|
|
0084a162f7 | |
|
|
d5fa17151f | |
|
|
937b3f37ab | |
|
|
7022d491ce | |
|
|
c4e8996a22 | |
|
|
757d547755 | |
|
|
79fb04fdb5 |
|
|
@ -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 }}"
|
||||
|
|
@ -33,3 +33,5 @@ lerna-debug.log*
|
|||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
||||
postgres-data/
|
||||
.env
|
||||
|
|
|
|||
42
Dockerfile
42
Dockerfile
|
|
@ -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 \
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
COPY package*.json ./
|
||||
|
||||
|
||||
RUN npm install --legacy-peer-deps
|
||||
|
||||
COPY . .
|
||||
|
||||
|
||||
EXPOSE 8068
|
||||
CMD ["npm", "run", "start:prod"]
|
||||
|
|
@ -1,14 +1,18 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
vendaweb:
|
||||
image: link70/vendaweb
|
||||
deploy:
|
||||
replicas: 20
|
||||
resources:
|
||||
limits:
|
||||
cpus: '0.5'
|
||||
memory: 512M
|
||||
vendaweb-api:
|
||||
image: 10.1.1.124:8082/library/vendaweb-api:latest
|
||||
ports:
|
||||
- "8065:8065"
|
||||
restart: always
|
||||
- "8068:8068"
|
||||
networks:
|
||||
- simplifique-network
|
||||
deploy:
|
||||
replicas: 4
|
||||
update_config:
|
||||
order: start-first
|
||||
parallelism: 1
|
||||
|
||||
networks:
|
||||
simplifique-network:
|
||||
external: true
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { Controller, Get } from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation } from '@nestjs/swagger';
|
||||
import { ApiOperation, ApiTags } 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: 'ok' };
|
||||
return { status: 'TESTE COM Felipe2 ' };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
serviceName: 'WINT',
|
||||
sid: "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,
|
||||
serviceName: 'WINT',
|
||||
sid: "WINT",
|
||||
synchronize: false,
|
||||
logging: false,
|
||||
entities: [__dirname + '/../**/*.entity.{js,ts}'],
|
||||
|
|
|
|||
|
|
@ -20,6 +20,6 @@ async function bootstrap() {
|
|||
.build();
|
||||
const document = SwaggerModule.createDocument(app, options);
|
||||
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();
|
||||
|
|
|
|||
|
|
@ -139,10 +139,8 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -367,66 +367,37 @@ 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) {
|
||||
|
|
|
|||
|
|
@ -1505,6 +1505,10 @@ export class SalesService {
|
|||
}
|
||||
|
||||
async calculateDeliveryTaxOrder(dataDeliveryTax: any) {
|
||||
<<<<<<< HEAD
|
||||
let cityId = await this.customerService.findCity(dataDeliveryTax.ibgeCode);
|
||||
|
||||
=======
|
||||
console.log("json dataDeliveryTax", dataDeliveryTax);
|
||||
/*const dataDeliveryTax = {
|
||||
cartId: cartId,
|
||||
|
|
@ -1519,6 +1523,7 @@ export class SalesService {
|
|||
} else {
|
||||
cityId = dataDeliveryTax.cityId;
|
||||
}
|
||||
>>>>>>> feat/painel-cliente
|
||||
await this.updatePriorityDelivery(dataDeliveryTax.cartId, dataDeliveryTax.priorityDelivery);
|
||||
|
||||
if (cityId == 0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue