-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
722 additions
and
1,211 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsNumber } from 'class-validator'; | ||
|
||
export class IncreaseChapterViewParamDto { | ||
@ApiProperty() | ||
@IsNumber() | ||
chapterId: number; | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { RedisService } from './redis.service'; | ||
|
||
@Module({ | ||
providers: [RedisService], | ||
exports: [RedisService], | ||
}) | ||
export class RedisModule {} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Injectable, Logger, OnModuleDestroy } from '@nestjs/common'; | ||
import { ConfigService } from '@nestjs/config'; | ||
import { RedisClientType, createClient } from 'redis'; | ||
|
||
@Injectable() | ||
export class RedisService implements OnModuleDestroy { | ||
private redisClient: RedisClientType; | ||
|
||
private readonly logger = new Logger(RedisService.name); | ||
constructor(private configService: ConfigService) { | ||
this.redisClient = createClient({ | ||
url: this.configService.get<string>('redis.url'), | ||
}); | ||
this.redisClient.connect().then(() => { | ||
this.logger.log('Redis Connected'); | ||
}); | ||
} | ||
|
||
onModuleDestroy() { | ||
this.redisClient.quit().then((msg: string) => { | ||
this.logger.log(`Quit Redis ${msg}`); | ||
}); | ||
} | ||
|
||
get client() { | ||
return this.redisClient; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { TasksService } from './task.service'; | ||
import { RedisModule } from '../redis/redis.module'; | ||
import { GraphqlModule } from '../graphql/graphql.module'; | ||
|
||
@Module({ | ||
imports: [RedisModule, GraphqlModule], | ||
providers: [TasksService], | ||
exports: [TasksService], | ||
}) | ||
export class TasksModule {} |
Oops, something went wrong.