Skip to content

Commit

Permalink
Merge pull request #201 from drackp2m/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
drackp2m authored Nov 12, 2024
2 parents b9837e4 + 860e85f commit a678a34
Show file tree
Hide file tree
Showing 18 changed files with 3,090 additions and 10,512 deletions.
2 changes: 0 additions & 2 deletions .devcontainer/docker-compose.yml.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.8'

services:
playsetonline-node:
build:
Expand Down
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ DB_USER=playsetonline
DB_PASS=password
DB_NAME=playsetonline
DB_NAME_TEST=playsetonline-test
DB_CERT=cert

API_PROTOCOL=https
API_DOMAIN=localhost
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22.9'
node-version: '23.1'
cache: 'npm'

- name: Install dependencies
Expand All @@ -52,7 +52,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22.9'
node-version: '23.1'
cache: 'npm'

- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22.9'
node-version: '23.1'
cache: 'npm'

- name: Install dependencies
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ Thumbs.db
.pgdata*
.docker
.env
certs
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:22.9-alpine3.20 AS base
FROM node:23.1-alpine3.20 AS base

RUN apk add --no-cache build-base python3

Expand All @@ -22,9 +22,9 @@ FROM base AS deps

USER node

COPY package.json package-lock* ./
COPY package.json ./

RUN npm ci
RUN npm install



Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/module/ping/ping.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ export class PingResolver {
},
})
getPings(): AsyncIterator<GetPingsOutput[]> {
return this.pubSub.asyncIterator<GetPingsOutput[]>(this.SEND_PING_TOPIC);
return this.pubSub.asyncIterableIterator<GetPingsOutput[]>(this.SEND_PING_TOPIC);
}
}
2 changes: 1 addition & 1 deletion apps/api/src/module/user/factory/user.faker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class UserFaker {

return new User({
uuid: faker.string.uuid(),
username: faker.internet.userName({ firstName, lastName }),
username: faker.internet.username({ firstName, lastName }),
password: faker.internet.password({
length: 32,
memorable: false,
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/module/user/user.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ export class UserResolver {
this.pubSub.publish('getManySubscription', message);
}, 5000);

return this.pubSub.asyncIterator('getManySubscription');
return this.pubSub.asyncIterableIterator('getManySubscription');
}
}
10 changes: 7 additions & 3 deletions apps/api/src/shared/environment/env.validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,24 @@ class EnvironmentVariables {

@IsString()
@IsNotEmpty()
DB_NAME!: string;
DB_USER!: string;

@IsString()
@IsNotEmpty()
DB_USER!: string;
DB_PASS!: string;

@IsString()
@IsNotEmpty()
DB_PASS!: string;
DB_NAME!: string;

@IsString()
@IsNotEmpty()
DB_NAME_TEST!: string;

@IsString()
@IsNotEmpty()
DB_CERT!: string;

@IsString()
@IsNotEmpty()
API_PROTOCOL!: ApiProtocol;
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/shared/module/config/mikro-orm.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { MikroOrmNamingStrategy } from './mikro-orm.naming-strategy';
import { databaseConfig } from './registers/database.config';

export default async (): Promise<MikroOrmModuleSyncOptions> => ({
debug: false,
driver: PostgreSqlDriver,
...databaseConfig(),
allowGlobalContext: false,
forceUtcTimezone: true,
tsNode: true,
preferTs: true,
autoLoadEntities: true,
extensions: [Migrator],
entities: ['apps/api/src/module/**/*.entity.ts'],
Expand Down
12 changes: 8 additions & 4 deletions apps/api/src/shared/module/config/registers/database.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import { MikroOrmModuleSyncOptions } from '@mikro-orm/nestjs';
import { registerAs } from '@nestjs/config';

import { validate } from '../../../environment/env.validation';
import { DatabaseConfig } from '../types/database-config.type';
import 'dotenv/config';

const config = validate(process.env);

const driverOptions = config.NODE_ENV === 'production' && {
driverOptions: { connection: { ssl: { ca: config.DB_CERT } } },
};

export const databaseConfig = registerAs(
'database',
(): DatabaseConfig => ({
(): MikroOrmModuleSyncOptions => ({
host: config.DB_HOST,
port: config.DB_PORT,
dbName: config.DB_NAME,
user: config.DB_USER,
password: config.DB_PASS,
dbName: config.DB_NAME,
...driverOptions,
}),
);
1 change: 1 addition & 0 deletions apps/api/src/typings/.env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare global {
DB_PASS: string;
DB_NAME: string;
DB_NAME_TEST: string;
DB_CERT: string;

API_PROTOCOL: string;
API_DOMAIN: string;
Expand Down
25 changes: 0 additions & 25 deletions certs/set-self-signed.crt

This file was deleted.

28 changes: 0 additions & 28 deletions certs/set-self-signed.key

This file was deleted.

1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"playsetonline",
"sonarjs",
"stylelint",
"tembo",
"tsparticles"
],
"ignoreWords": [],
Expand Down
Loading

0 comments on commit a678a34

Please sign in to comment.