Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 48 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,58 @@
FROM node:14 as servidor_mapas
# --- STAGE 1: Build & Setup stage ---
# Use the specific base image you require (Node 16 with Bullseye)
FROM node:16-bullseye AS build
WORKDIR /app

WORKDIR /usr/src/app
# Install necessary system dependencies (Python/Pip/other libs)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3 python3-pip \
# Add any other required build dependencies here
&& rm -rf /var/lib/apt/lists/*

COPY package.json ./
COPY tsconfig.json ./
# Install Python packages
RUN pip3 install --no-cache-dir numpy pillow lxml fastapi

COPY ./src ./src
COPY ./prisma ./prisma
COPY ./@types ./@types
# Create necessary directories
RUN mkdir -p /app/assets/xml /app/assets/maps /app/assets/thumbs /app/uploads

RUN npm install --force

# Install Node dependencies
COPY package*.json ./
COPY prisma ./prisma
# 'npm ci --omit=dev' is excellent for production
RUN npm ci --omit=dev || npm install --force

# Generate Prisma client
RUN npm run prisma:gen

# Build the application (e.g., TypeScript compilation)
COPY . .
RUN npm run build

ENV DATABASE_URL="mysql://root:@[email protected]:3306/servidor_mapas"
ENV PORT=8888
# --- STAGE 2: Production Run stage ---
# Use a smaller/more secure runtime if possible (e.g., Node 16 slim/alpine, but careful with native modules)
# Stick to the same base for maximum compatibility since we installed system libs
FROM node:16-bullseye
WORKDIR /ena-map-server-back

# Install *only* runtime dependencies if necessary (e.g., python/pip/libs needed at runtime)
# Re-install system packages necessary for runtime:
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3 python3-pip \
# Add any other required runtime dependencies here
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install --no-cache-dir numpy pillow lxml fastapi

# Copy only the necessary files from the build stage
# Note: /app is the build directory, /ena-map-server-back is the final working directory
COPY --from=build /app /ena-map-server-back

EXPOSE 8888

EXPOSE 80
EXPOSE 443
EXPOSE 8080
# Set environment variables (optional, better in docker-compose)
# ENV NODE_ENV production

# The final production start command
CMD ["npm", "start"]
Binary file added assets/img/map (1)-1766977582409.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/map (1)-1766978529628.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/mapt-1766966462030-1766976673081.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/testenovo-1766976961441.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
136 changes: 136 additions & 0 deletions assets/xml/map-(1)-1766978529628.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<root xmlns="http://www.w3.org/1999/xhtml"><layers><layer name="floor" tileset="floor">5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,3.1,3.1,3.1,3.1,3.1,3.1,3.1,3.1

,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,3.1,3.1,3.1,3.1,3.1,3.1,3.1,3.1

,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,3.1,3.1,3.1,3.1,3.1,3.1,3.1,3.1

,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,3.1,3.1,3.1,3.1,3.1,3.1,3.1,3.1

,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,4.0,4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1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
</layer></layers><tilesets><tileset name="walls" image="walls" imagewidth="224" imageheight="94" tilewidth="32" tileheight="32"></tileset><tileset name="floor" image="floor" imagewidth="256" imageheight="64" tilewidth="32" tileheight="32"></tileset><tileset name="door_and_windows" image="door_and_windows" imagewidth="253" imageheight="96" tilewidth="32" tileheight="32"></tileset><tileset name="utensils" image="utensils" imagewidth="246" imageheight="127" tilewidth="32" tileheight="32"></tileset><tileset name="eletronics" image="eletronics" imagewidth="252" imageheight="127" tilewidth="32" tileheight="32"></tileset><tileset name="persons" image="persons" imagewidth="121" imageheight="29" tilewidth="32" tileheight="32"></tileset><tileset name="interactive_elements" image="interactive_elements" imagewidth="252" imageheight="124" tilewidth="32" tileheight="32"></tileset><tileset name="furniture" image="furniture" imagewidth="256" imageheight="444" tilewidth="32" tileheight="32"></tileset></tilesets><canvas width="800" height="480"></canvas></root>
2 changes: 1 addition & 1 deletion example.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
DATABASE_URL=mysql://root:root@localhost:3306/servidor_mapas
DATABASE_URL=mysql://admin:Cefet@[email protected]:3306/servidor_mapas
JWT_SECRET=abcd1234-ab12-ba12-1212-123456789abc
2 changes: 1 addition & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default class Server {
origin: '*',
}),
);
this.express.use('/image/', express.static('./assets/img'));
this.express.use('/image', express.static(path.join(process.cwd(), 'assets', 'img')));
dotenv.config();
}

Expand Down
38 changes: 19 additions & 19 deletions src/services/MapService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { CrudService } from './CrudService';
import { scriptReader } from '../utils/scriptReader';
import fs from 'fs';
import path from 'path';
import { groupMapRepositoryByIdMap } from '../repository/GroupMapRepository';
import { groupMapRepositoryByIdMap } from '../repository/GroupMapRepository';
import { userMapRepository } from '../repository/UserMapRepository';

class MapService extends CrudService<MapDTO, CreateMapDTO, UpdateMapDTO> {
Expand All @@ -17,7 +17,7 @@ class MapService extends CrudService<MapDTO, CreateMapDTO, UpdateMapDTO> {
}


async saveXmlFile(data: any) {
async saveXmlFile(data: any) {
const pathName = path.resolve(
__dirname,
'../../',
Expand All @@ -31,11 +31,11 @@ class MapService extends CrudService<MapDTO, CreateMapDTO, UpdateMapDTO> {
return await scriptReader.convertXmlToJson(data);
}

async deleteOldFileXml(data: any) {
async deleteOldFileXml(fileName: string) {
const pathName = path.resolve(
__dirname,
'../../',
`assets/xml/${data.fileName.toLowerCase().replace(' ', '-')}.xml`,
`assets/xml/${fileName.toLowerCase().replace(' ', '-')}.xml`,
);

fs.unlinkSync(pathName);
Expand All @@ -47,12 +47,12 @@ class MapService extends CrudService<MapDTO, CreateMapDTO, UpdateMapDTO> {
url: data.url,
}

if(data.new_file === 'true') {
this.deleteOldFileXml(data.last_file_name)
this.saveXmlFile({ name: data.files[0].name, file: data.files[0] })
if (data.new_file === 'true' && data.last_file_name) {
this.deleteOldFileXml(data.last_file_name);
this.saveXmlFile({ name: data.files[0].name, file: data.files[0] })
const mapJson = await this.convertXmlFile({ name: data.files[0].name, minify: true, file: data.files[0] });

if(!mapJson) {
if (!mapJson) {
throw new Error('Failed to convert JSON');
}

Expand All @@ -62,7 +62,7 @@ class MapService extends CrudService<MapDTO, CreateMapDTO, UpdateMapDTO> {


return mapRepository.update(id, newData);

}

override async create(data: CreateMapConvert): Promise<any> {
Expand All @@ -72,19 +72,19 @@ class MapService extends CrudService<MapDTO, CreateMapDTO, UpdateMapDTO> {
id_owner: parseInt(`${data.id_owner}`),
}

this.saveXmlFile({ name: data.files[0].name, file: data.files[0] })
const mapJson = await this.convertXmlFile({ name: data.files[0].name, minify: true, file: data.files[0] });
this.saveXmlFile({ name: data.files[0].name, file: data.files[0] })
const mapJson = await this.convertXmlFile({ name: data.files[0].name, minify: true, file: data.files[0] });

if(!mapJson) {
throw new Error('Failed to convert JSON');
}
if (!mapJson) {
throw new Error('Failed to convert JSON');
}

newData.tag = JSON.stringify(mapJson);
newData.thumb_url = data.files[0].name;

return mapRepository.create(newData);
}

override async delete(id:number):Promise<any> {

const mapSelected = await mapRepository.getById(id);
Expand All @@ -103,7 +103,7 @@ class MapService extends CrudService<MapDTO, CreateMapDTO, UpdateMapDTO> {
const mapResponse = await mapRepository.getById(idMapa);

if (mapResponse) {

const pathName = path.resolve(
__dirname,
'../../',
Expand Down Expand Up @@ -159,13 +159,13 @@ class MapService extends CrudService<MapDTO, CreateMapDTO, UpdateMapDTO> {
}
}


async findAllPaged(page: string, limit: string, search: string): Promise<any | null> {
const users = await mapRepository.getAllPaged(page, limit, search);
const count = await mapRepository.countAll();

const take = limit ? Number(limit) : users.length;
return { data: users, limit: take, page: Number(page), count};
return { data: users, limit: take, page: Number(page), count };
}
}

Expand Down