|
@@ -14,6 +14,7 @@ import { Moments } from './entities/moments.entity'
|
|
|
import { paginate, Pagination } from 'nestjs-typeorm-paginate'
|
|
import { paginate, Pagination } from 'nestjs-typeorm-paginate'
|
|
|
import { PageRequest } from '../common/dto/page-request'
|
|
import { PageRequest } from '../common/dto/page-request'
|
|
|
import { ChatRoleService } from 'src/chat-role/chat-role.service'
|
|
import { ChatRoleService } from 'src/chat-role/chat-role.service'
|
|
|
|
|
+import { ro } from 'date-fns/locale'
|
|
|
|
|
|
|
|
@Injectable()
|
|
@Injectable()
|
|
|
export class MomentsService {
|
|
export class MomentsService {
|
|
@@ -40,16 +41,10 @@ export class MomentsService {
|
|
|
return page
|
|
return page
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- public async findById(id: number): Promise<Moments> {
|
|
|
|
|
- const moments = await this.momentsRepository.findOneBy({
|
|
|
|
|
- id: +id
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- if (!moments) {
|
|
|
|
|
- throw new NotFoundException(`Monents #${id} not found`)
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ async findById(id: number): Promise<Moments> {
|
|
|
|
|
+ const moments = await this.momentsRepository.findOneBy({ id: +id })
|
|
|
|
|
+ const chatRole = await this.chatRoleService.findById(moments.userId)
|
|
|
|
|
+ moments.chatRole = chatRole
|
|
|
return moments
|
|
return moments
|
|
|
}
|
|
}
|
|
|
|
|
|