Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

Commit 0b419ea

Browse files
committed
fix(build): change BuildingDocument return types to Building and adjust docker-compose
1 parent 263e0dd commit 0b419ea

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

docker-compose.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,12 @@ services:
33
nats:
44
image: nats:2.8
55
ports:
6-
- "4222:4222"
6+
- "4222:4222"
7+
database:
8+
image: mongo:7
9+
ports:
10+
- "27018:27017"
11+
volumes:
12+
- data:/data/db
13+
volumes:
14+
data:

src/settlers/building/building.service.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ export class BuildingService {
1515
) {
1616
}
1717

18-
async findAll(gameId: string, filter: FilterQuery<Building> = {}): Promise<BuildingDocument[]> {
18+
async findAll(gameId: string, filter: FilterQuery<Building> = {}): Promise<Building[]> {
1919
return this.model.find({ ...filter, gameId }).exec();
2020
}
2121

22-
async findOne(id: string): Promise<BuildingDocument | null> {
22+
async findOne(id: string): Promise<Building | null> {
2323
return this.model.findById(id).exec();
2424
}
2525

26-
async create(gameId: string, owner: string, building: CreateBuildingDto): Promise<BuildingDocument> {
26+
async create(gameId: string, owner: string, building: CreateBuildingDto): Promise<Building> {
2727
const created = await this.model.create({
2828
...building,
2929
gameId,
@@ -33,7 +33,7 @@ export class BuildingService {
3333
return created;
3434
}
3535

36-
async update(id: string, building: UpdateBuildingDto): Promise<BuildingDocument | null> {
36+
async update(id: string, building: UpdateBuildingDto): Promise<Building | null> {
3737
const updated = await this.model.findByIdAndUpdate(id, building, { new: true });
3838
updated && this.emit('updated', updated);
3939
return updated;
@@ -45,7 +45,7 @@ export class BuildingService {
4545
this.emit('deleted', ...buildings);
4646
}
4747

48-
private emit(event: string, ...buildings: BuildingDocument[]) {
48+
private emit(event: string, ...buildings: Building[]) {
4949
if (!buildings.length) {
5050
return;
5151
}

src/settlers/move/game-logic/trade.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { BadRequestException, ForbiddenException, Injectable, NotFoundException } from '@nestjs/common';
22
import { FilterQuery, UpdateQuery } from 'mongoose';
3-
import { BuildingDocument } from '../../building/building.schema';
3+
import {Building, BuildingDocument} from '../../building/building.schema';
44
import { BuildingService } from '../../building/building.service';
55
import { MapService } from '../../map/map.service';
66
import { Player, ResourceCount } from '../../player/player.schema';
@@ -92,7 +92,7 @@ export class TradeService {
9292
}
9393
}
9494

95-
private async findBuildingsNearHarbors(gameId: string, userId: string, type: ResourceType | undefined): Promise<BuildingDocument[]> {
95+
private async findBuildingsNearHarbors(gameId: string, userId: string, type: ResourceType | undefined): Promise<Building[]> {
9696
const map = await this.mapService.findByGame(gameId);
9797
if (!map) {
9898
throw new NotFoundException(gameId);

0 commit comments

Comments
 (0)