This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable, OnApplicationShutdown } from '@nestjs/common'; | |
import { FeedbackFactoryServices } from './feedback-factory.service'; | |
import { DataSource } from 'typeorm'; | |
import { IDatabaseServices } from 'src/core'; | |
@Injectable() | |
export class FeedbackServices implements OnApplicationShutdown { | |
constructor( | |
private readonly data: IDatabaseServices, | |
private readonly factory: FeedbackFactoryServices, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** generic repository */ | |
/* eslint-disable @typescript-eslint/no-unused-vars */ | |
import { Model } from 'sequelize'; | |
import { IGenericRepository } from 'src/core'; | |
export class SequelizeGenericRepository<T extends Model> | |
implements IGenericRepository<T> | |
{ | |
private model: any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* gets the userId | |
* creates a redis key(identifier) | |
* checks if the key exists | |
* returns the data instead | |
*/ | |
const redisKey = `transactions-v3-${userId}-${JSON.stringify(payload)}`; | |
const redisValue = await this.cache.get(redisKey); | |
if (redisValue) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { data, pagination } = | |
await this.data.transactions.findAllWithPagination( | |
{ | |
...filterQuery, | |
isRevenue: false, | |
reconTransactionType: Not(In(excludedTransactionType)), | |
}, | |
{ | |
relationFields: ['user'], | |
selectFields: this.selectFields, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const selectFields = [ | |
'id', | |
'currency', | |
'currencyType', | |
'amount', | |
'type', | |
'reference', | |
'description', | |
'status', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use @UploadedFile() when uploading a single file/video/image | |
@Post('/upload-file') | |
@UseInterceptors(FileInterceptor('video')) | |
async createCheckedIn( | |
@UploadedFile() file: Express.Multer.File, | |
@Res() res: Response, | |
) {} | |
// use @UploadedFiles() when uploading multiple file/video/images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://cdn.socket.io/4.3.2/socket.io.min.js" | |
integrity="sha384-KAZ4DtjNhLChOB/hxXuKqhMLYvx3b5MlT55xPEiNmREKRzeEm+RVPlTnAn0ajQNs" | |
crossorigin="anonymous"></script> | |
<script> | |
const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Ijc3YTJhMzdhLTA2ZDMtNGUwZC05OTVlLWMyZDI0YTZhZGVjMSIsInR5cGUiOiJhdXRoIiwiaWF0IjoxNzIzMDYyMDgxLCJleHAiOjE3MjMxNDg0ODF9.F19lekTdIeumR8uVlQeuJdXjAL81Ye5G_FCWRyU335U" | |
const socket = io('http://localhost:2242', { | |
query: { token } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": [ | |
{ | |
"name": "9mobile 9Payment Service Bank", | |
"code": "120001" | |
}, | |
{ | |
"name": "Abbey Mortgage Bank", | |
"code": "404" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": 376, | |
"InstitutionCode": "090270", | |
"InstitutionName": "AB MICROFINANCE BANK", | |
"Category": "9", | |
"dump": null, | |
"created_at": "2020-03-02 20:44:54", | |
"updated_at": "2020-08-24 00:02:52", | |
"deleted_at": null, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DataSource } from 'typeorm'; | |
import { ConfigService } from '@nestjs/config'; | |
import { config } from 'dotenv'; | |
import models from '../../models'; | |
config(); | |
const configService = new ConfigService(); | |
export default new DataSource({ | |
type: 'postgres', |
NewerOlder