mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-13 07:04:50 -06:00
feat: updates api evolution for docker
This commit is contained in:
parent
1665654676
commit
2fb6318011
@ -1,5 +1,7 @@
|
||||
.git
|
||||
*Dockerfile*
|
||||
*docker-compose*
|
||||
package-lock.json
|
||||
.env
|
||||
node_modules
|
||||
dist
|
@ -1,24 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Fonte das variáveis de ambiente
|
||||
source ./Docker/scripts/env_functions.sh
|
||||
|
||||
# Carregar variáveis de ambiente se não estiver no ambiente Docker
|
||||
if [ "$DOCKER_ENV" != "true" ]; then
|
||||
export_env_vars
|
||||
fi
|
||||
|
||||
# Verificar se o banco de dados é PostgreSQL ou MySQL
|
||||
if [[ "$DATABASE_PROVIDER" == "postgresql" || "$DATABASE_PROVIDER" == "mysql" ]]; then
|
||||
export DATABASE_URL
|
||||
echo "Deploying migrations for $DATABASE_PROVIDER"
|
||||
echo "Database URL: $DATABASE_URL"
|
||||
# rm -rf ./prisma/migrations
|
||||
# cp -r ./prisma/$DATABASE_PROVIDER-migrations ./prisma/migrations
|
||||
npm run db:deploy
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Migration failed"
|
||||
exit 1
|
||||
|
||||
# Verificar se há migrações pendentes com Prisma
|
||||
MIGRATION_STATUS=$(npx prisma migrate status)
|
||||
|
||||
if echo "$MIGRATION_STATUS" | grep -q "Pending"; then
|
||||
echo "Migrações pendentes encontradas. Executando deploy..."
|
||||
npm run db:deploy # Aplica as migrações pendentes
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Migration failed"
|
||||
exit 1
|
||||
else
|
||||
echo "Migration succeeded"
|
||||
fi
|
||||
else
|
||||
echo "Migration succeeded"
|
||||
echo "Nenhuma migração pendente. Pulando deploy."
|
||||
fi
|
||||
|
||||
# Gerar o Prisma Client após o deploy
|
||||
npm run db:generate
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Prisma generate failed"
|
||||
@ -26,6 +38,7 @@ if [[ "$DATABASE_PROVIDER" == "postgresql" || "$DATABASE_PROVIDER" == "mysql" ]]
|
||||
else
|
||||
echo "Prisma generate succeeded"
|
||||
fi
|
||||
|
||||
else
|
||||
echo "Error: Database provider $DATABASE_PROVIDER invalid."
|
||||
exit 1
|
||||
|
@ -1,7 +1,7 @@
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
RUN apk update && \
|
||||
apk add git ffmpeg wget curl bash
|
||||
apk add --no-cache git ffmpeg wget curl bash openssl
|
||||
|
||||
LABEL version="2.2.0" description="Api to control whatsapp features through http requests."
|
||||
LABEL maintainer="Davidson Gomes" git="https://github.com/DavidsonGomes"
|
||||
|
@ -14,7 +14,9 @@
|
||||
"db:generate": "node runWithProvider.js \"npx prisma generate --schema ./prisma/DATABASE_PROVIDER-schema.prisma\"",
|
||||
"db:deploy": "node runWithProvider.js \"rm -rf ./prisma/migrations && cp -r ./prisma/DATABASE_PROVIDER-migrations ./prisma/migrations && npx prisma migrate deploy --schema ./prisma/DATABASE_PROVIDER-schema.prisma\"",
|
||||
"db:studio": "node runWithProvider.js \"npx prisma studio --schema ./prisma/DATABASE_PROVIDER-schema.prisma\"",
|
||||
"db:migrate:dev": "node runWithProvider.js \"rm -rf ./prisma/migrations && cp -r ./prisma/DATABASE_PROVIDER-migrations ./prisma/migrations && npx prisma migrate dev --schema ./prisma/DATABASE_PROVIDER-schema.prisma && cp -r ./prisma/migrations/* ./prisma/DATABASE_PROVIDER-migrations\""
|
||||
"db:migrate:dev": "node runWithProvider.js \"rm -rf ./prisma/migrations && cp -r ./prisma/DATABASE_PROVIDER-migrations ./prisma/migrations && npx prisma migrate dev --schema ./prisma/DATABASE_PROVIDER-schema.prisma && cp -r ./prisma/migrations/* ./prisma/DATABASE_PROVIDER-migrations\"",
|
||||
"docker:build": "docker build -t joaovictorsouza/evolution-api:latest .",
|
||||
"docker:push": "docker push joaovictorsouza/evolution-api:latest"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -51,7 +53,7 @@
|
||||
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
||||
"@figuro/chatwoot-sdk": "^1.1.16",
|
||||
"@hapi/boom": "^10.0.1",
|
||||
"@prisma/client": "^5.15.0",
|
||||
"@prisma/client": "^6.1.0",
|
||||
"@sentry/node": "^8.28.0",
|
||||
"amqplib": "^0.10.3",
|
||||
"axios": "^1.6.5",
|
||||
@ -82,7 +84,7 @@
|
||||
"openai": "^4.52.7",
|
||||
"pg": "^8.11.3",
|
||||
"pino": "^8.11.0",
|
||||
"prisma": "^5.15.0",
|
||||
"prisma": "^6.1.0",
|
||||
"pusher": "^5.2.0",
|
||||
"qrcode": "^1.5.1",
|
||||
"qrcode-terminal": "^0.12.0",
|
||||
|
@ -72,14 +72,15 @@ export class WAMonitoringService {
|
||||
|
||||
const clientName = this.configService.get<Database>('DATABASE').CONNECTION.CLIENT_NAME;
|
||||
|
||||
const where = instanceNames && instanceNames.length > 0
|
||||
? {
|
||||
name: {
|
||||
in: instanceNames,
|
||||
},
|
||||
clientName,
|
||||
}
|
||||
: { clientName };
|
||||
const where =
|
||||
instanceNames && instanceNames.length > 0
|
||||
? {
|
||||
name: {
|
||||
in: instanceNames,
|
||||
},
|
||||
clientName,
|
||||
}
|
||||
: { clientName };
|
||||
|
||||
const instances = await this.prismaRepository.instance.findMany({
|
||||
where,
|
||||
|
@ -131,7 +131,14 @@ export declare namespace wa {
|
||||
export type StatusMessage = 'ERROR' | 'PENDING' | 'SERVER_ACK' | 'DELIVERY_ACK' | 'READ' | 'DELETED' | 'PLAYED';
|
||||
}
|
||||
|
||||
export const TypeMediaMessage = ['imageMessage', 'documentMessage', 'audioMessage', 'videoMessage', 'stickerMessage', 'ptvMessage'];
|
||||
export const TypeMediaMessage = [
|
||||
'imageMessage',
|
||||
'documentMessage',
|
||||
'audioMessage',
|
||||
'videoMessage',
|
||||
'stickerMessage',
|
||||
'ptvMessage',
|
||||
];
|
||||
|
||||
export const MessageSubtype = [
|
||||
'ephemeralMessage',
|
||||
|
Loading…
Reference in New Issue
Block a user