diff --git a/README.md b/README.md index 0d1de20..81339fb 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Messaging - https://www.postman.com/kairosclicks/workspace/ko/collection/69cbc76 The above are sperated into various collections because the former is HTTP where as the latter is WS and cannot not be in the same collection - Swagger Open API: https://collaborative-v1.onrender.com/api-documentation +- See Test section for test users. ## Features - Authentication: @@ -73,26 +74,37 @@ The above are sperated into various collections because the former is HTTP where - To migrate run: ```bash - npm run migration:run + npm run migration:run:dev - To revert run: ```bash - npm run migration:revert + npm run migration:revert:dev -## Testing - To run test: +### Testing + -To run test: ```bash - npm run migration:revert + npm run test + ``` + + - Test users: + 1. email: "johnydoe@mailsac.com" ; Password: "Password123#" + 2. email: "lukadoe@mailsac.com" ; Password: "Password123#" + +### Guidlines + - Entity Class property names should be camel-cased and it is automatically converted to snake-cased column name. Hence, hence column names should not be manually set to avoid naming errors. -## Improvements with more time -- Logging +### Improvements with more time +- Voice to text +- Voice message (Voice Notes) +- Full implementation for "last seen" +- Better logging - Authentication Refresh - Message threads. (A bit similar to the replyTo feature but more like a tree) - Message translation - Caching messages for to tune perfomance - Chatroom invite link - Chatroom roles -- As admin Remove user from chat room +- Admin of a channel Remove user from chat room - Email service - More Unit tests diff --git a/package.json b/package.json index baeb008..31637e9 100644 --- a/package.json +++ b/package.json @@ -12,11 +12,13 @@ "start:dev": "nest start --watch", "start:debug": "nest start --debug --watch", "start:prod": "node dist/main", - "typeorm": "node ./node_modules/typeorm/cli.js --dataSource ./dist/common/utils/dataSource.util.js", - "typeorm:dev": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js --dataSource src/common/utils/dataSource.util.ts", + "typeorm": "node ./node_modules/typeorm/cli.js --dataSource ./dist/common/utils/datasource.util.js", "migration:generate": "npm run typeorm:dev migration:generate --", "migration:run": "npm run typeorm migration:run", + "migration:revert": "npm run typeorm migration:revert", + "typeorm:dev": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js --dataSource src/common/utils/datasource.util.ts", "migration:run:dev": "npm run typeorm:dev migration:run", + "migration:revert:dev": "npm run typeorm:dev migration:revert", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "test": "jest", "test:watch": "jest --watch", diff --git a/src/common/utils/datasource.util.ts b/src/common/utils/datasource.util.ts index 11fe245..67e10df 100644 --- a/src/common/utils/datasource.util.ts +++ b/src/common/utils/datasource.util.ts @@ -3,17 +3,19 @@ import { SnakeCaseNamingStrategy } from 'src/common/utils/snake-case-naming-stra import * as dotenv from 'dotenv'; import { DataSource } from 'typeorm'; import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions'; -import path from 'path'; + +dotenv.config(); export const getDefaultDataSource = () => { dotenv.config(); const databaseConfig = getConfig(); + const isProd = process.env.NODE_ENV === 'production'; return new DataSource({ ...databaseConfig, - entities: ['src/**/*.entity.ts'], - migrations: ['src/migrations/*.ts'], + entities: isProd ? ['dist/**/*.entity.js'] : ['src/**/*.entity.ts'], + migrations: isProd ? ['dist/migrations/*.js'] : ['src/migrations/*.ts'], namingStrategy: new SnakeCaseNamingStrategy(), } as PostgresConnectionOptions); };