Skip to content
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 5 additions & 3 deletions src/common/utils/datasource.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down