mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
remove expired room
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Result } from 'neverthrow';
|
||||
import { IActionsRepository } from 'src/app/core/actions/repository/actionsRepository';
|
||||
import { HttpAdapter } from 'src/app/infra/http/adapter'
|
||||
import { HttpResult } from 'src/app/infra/http/type';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ActionsRepositoryService implements IActionsRepository {
|
||||
|
||||
|
||||
private readonly baseUrl = '/api/v2/PresidentialActions';
|
||||
|
||||
constructor(
|
||||
private HttpAdapter: HttpAdapter
|
||||
) {}
|
||||
|
||||
// POST /api/v2/PresidentialActions
|
||||
async createPresidentialAction(body: any): Promise<Result<HttpResult<any>, HttpErrorResponse>> {
|
||||
const url = `${this.baseUrl}`;
|
||||
return this.HttpAdapter.post<any>(url, body);
|
||||
}
|
||||
|
||||
// GET /api/v2/PresidentialActions
|
||||
async getPresidentialActions(): Promise<Result<HttpResult<any>, HttpErrorResponse>> {
|
||||
const url = `${this.baseUrl}`;
|
||||
return this.HttpAdapter.get<any>(url);
|
||||
}
|
||||
|
||||
// GET /api/v2/PresidentialActions/{processId}
|
||||
async getPresidentialActionById(processId: number): Promise<Result<HttpResult<any>, HttpErrorResponse>> {
|
||||
const url = `${this.baseUrl}/${processId}`;
|
||||
return this.HttpAdapter.get<any>(url);
|
||||
}
|
||||
|
||||
// DELETE /api/v2/PresidentialActions/{processId}
|
||||
async deletePresidentialAction(processId: number): Promise<Result<HttpResult<any>, HttpErrorResponse>> {
|
||||
const url = `${this.baseUrl}/${processId}`;
|
||||
return this.HttpAdapter.delete<any>(url);
|
||||
}
|
||||
|
||||
// PUT /api/v2/PresidentialActions/{processId}
|
||||
async updatePresidentialAction(processId: number, body: any): Promise<Result<HttpResult<any>, HttpErrorResponse>> {
|
||||
const url = `${this.baseUrl}/${processId}`;
|
||||
return this.HttpAdapter.put<any>(url, body);
|
||||
}
|
||||
|
||||
// GET /api/v2/PresidentialActions/{processId}/Posts
|
||||
async getPostsByProcessId(processId: number): Promise<Result<HttpResult<any>, HttpErrorResponse>> {
|
||||
const url = `${this.baseUrl}/${processId}/Posts`;
|
||||
return this.HttpAdapter.get<any>(url);
|
||||
}
|
||||
|
||||
// DELETE /api/v2/PresidentialActions/{processId}/Posts/{documentId}
|
||||
async deletePostByDocumentId(processId: number, documentId: number): Promise<Result<HttpResult<any>, HttpErrorResponse>> {
|
||||
const url = `${this.baseUrl}/${processId}/Posts/${documentId}`;
|
||||
return this.HttpAdapter.delete<any>(url);
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,6 @@ export class ChatModule {
|
||||
const connection = this.SignalRService.getConnectionState()
|
||||
|
||||
connection.pipe(
|
||||
skip(1) // Skip the first value
|
||||
).subscribe((value: boolean)=> {
|
||||
if(value) {
|
||||
// on reconnect
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { IAttachmentLocalRepository } from 'src/app/core/chat/repository/typing/typing-local-repository';
|
||||
import { AttachmentTable, AttachmentTableSchema } from 'src/app/infra/database/dexie/instance/chat/schema/attachment';
|
||||
import { chatDatabase } from 'src/app/infra/database/dexie/service';
|
||||
import { chatDatabase } from 'src/app/infra/database/dexie/instance/chat/service';
|
||||
import { DexieRepository } from 'src/app/infra/repository/dexie/dexie-repository.service';
|
||||
|
||||
@Injectable({
|
||||
|
||||
+5
-4
@@ -2,7 +2,7 @@ import { Injectable, Input } from '@angular/core';
|
||||
import { IAttachmentRemoteRepository } from 'src/app/core/chat/repository/attachment/attachment-remote-repository';
|
||||
import { HttpService } from 'src/app/services/http.service';
|
||||
import { DataSourceReturn } from 'src/app/services/Repositorys/type';
|
||||
|
||||
import { HttpAdapter } from 'src/app/infra/http/adapter'
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -10,11 +10,12 @@ export class AttachmentRemoteDataSourceService implements IAttachmentRemoteRepos
|
||||
private baseUrl = 'https://gdapi-dev.dyndns.info/stage/api/v2/Chat'; // Your base URL
|
||||
|
||||
constructor(
|
||||
private httpService: HttpService
|
||||
private httpService: HttpService,
|
||||
private HttpAdapter: HttpAdapter
|
||||
) { }
|
||||
|
||||
async getAttachment(id: string | number): DataSourceReturn<Blob> {
|
||||
return await this.httpService.getFile(`${this.baseUrl}/attachment/${id}`, { responseType: 'blob' });
|
||||
async getAttachment(id: string | number) {
|
||||
return await this.HttpAdapter.get<Blob>(`${this.baseUrl}/attachment/${id}`, { responseType: 'blob' })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { from } from "rxjs";
|
||||
import { DexieRepository } from "src/app/infra/repository/dexie/dexie-repository.service";
|
||||
import { Dexie, EntityTable, liveQuery, Observable } from 'Dexie';
|
||||
import { BoldTable, BoldTableSchema } from "src/app/infra/database/dexie/instance/chat/schema/bold";
|
||||
import { chatDatabase } from "src/app/infra/database/dexie/service";
|
||||
import { chatDatabase } from "src/app/infra/database/dexie/instance/chat/service";
|
||||
import { IBoldLocalRepository } from "src/app/core/chat/repository/bold/bold-local-repository";
|
||||
|
||||
@Injectable({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DistributionTable, DistributionTableSchema,DistributionTableColumn } from "src/app/infra/database/dexie/instance/chat/schema/destribution";
|
||||
import { chatDatabase } from "src/app/infra/database/dexie/service";
|
||||
import { chatDatabase } from "src/app/infra/database/dexie/instance/chat/service";
|
||||
import { DexieRepository } from "src/app/infra/repository/dexie/dexie-repository.service";
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { err, Result } from 'neverthrow';
|
||||
import { MemberListUPdateStatusInputDTO } from '../../../domain/use-case/socket/member-list-update-status-use-case.service';
|
||||
import { from } from 'rxjs';
|
||||
import { MemberTable, MemberTableSchema } from 'src/app/infra/database/dexie/instance/chat/schema/members';
|
||||
import { chatDatabase } from 'src/app/infra/database/dexie/service';
|
||||
import { chatDatabase } from 'src/app/infra/database/dexie/instance/chat/service';
|
||||
import { IDirectMemberInput, IGetMemberLive, IMemberLocalRepository } from 'src/app/core/chat/repository/member/member-local-repository';
|
||||
|
||||
@Injectable({
|
||||
|
||||
@@ -4,7 +4,7 @@ import { MessageEntity } from '../../../../../core/chat/entity/message';
|
||||
import { DexieRepository } from 'src/app/infra/repository/dexie/dexie-repository.service';
|
||||
import { Observable as DexieObservable, PromiseExtended } from 'Dexie';
|
||||
import { DexieMessageTable, MessageTable, MessageTableSchema } from 'src/app/infra/database/dexie/instance/chat/schema/message';
|
||||
import { chatDatabase } from 'src/app/infra/database/dexie/service';
|
||||
import { chatDatabase } from 'src/app/infra/database/dexie/instance/chat/service';
|
||||
import { IDirectMessages, IMessageLocalRepository } from 'src/app/core/chat/repository/message/message-local-repository';
|
||||
import { BehaviorSubject, combineLatest, from, Observable } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
|
||||
@@ -3,7 +3,7 @@ import { liveQuery, Observable } from 'Dexie';
|
||||
import { DexieRepository } from 'src/app/infra/repository/dexie/dexie-repository.service';
|
||||
import { BehaviorSubject, from } from 'rxjs';
|
||||
import { RoomTable, RoomTableSchema } from 'src/app/infra/database/dexie/instance/chat/schema/room';
|
||||
import { chatDatabase } from 'src/app/infra/database/dexie/service';
|
||||
import { chatDatabase } from 'src/app/infra/database/dexie/instance/chat/service';
|
||||
import { IRoomLocalRepository } from 'src/app/core/chat/repository/room/room-local-repository';
|
||||
import { IDBoolean } from 'src/app/infra/database/dexie/type';
|
||||
import { RoomType } from 'src/app/core/chat/entity/group';
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { z } from 'zod';
|
||||
import { Dexie, EntityTable, liveQuery, Observable } from 'Dexie';
|
||||
import { err, ok } from 'neverthrow';
|
||||
import { chatDatabase } from 'src/app/infra/database/dexie/service';
|
||||
import { chatDatabase } from 'src/app/infra/database/dexie/instance/chat/service';
|
||||
import { TypingTable, TypingTableSchema } from 'src/app/infra/database/dexie/instance/chat/schema/typing';
|
||||
import { ITypingLocalRepository } from 'src/app/core/chat/repository/attachment/attachment-local-repository';
|
||||
import { DexieRepository } from 'src/app/infra/repository/dexie/dexie-repository.service';
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import Dexie, { PromiseExtended } from 'Dexie';
|
||||
import { IUserPhotoLocalRepository } from 'src/app/core/chat/repository/user-photo/user-photo-local-repository';
|
||||
import { UserPhotoTable, UserPhotoTableSchema } from 'src/app/infra/database/dexie/instance/chat/schema/user-foto';
|
||||
import { chatDatabase } from 'src/app/infra/database/dexie/service';
|
||||
import { chatDatabase } from 'src/app/infra/database/dexie/instance/chat/service';
|
||||
import { DexieRepository } from 'src/app/infra/repository/dexie/dexie-repository.service';
|
||||
|
||||
@Injectable({
|
||||
|
||||
@@ -164,7 +164,6 @@ export class ChatServiceService {
|
||||
}
|
||||
|
||||
async start() {
|
||||
this.chatSync()
|
||||
this.SocketConnectUseCaseService.execute();
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -64,24 +64,24 @@ export class MessageAttachmentByMessageIdUseCase {
|
||||
tracing.setAttribute('download', 'true')
|
||||
tracing.setAttribute('attachmentId', input.attachments[0].id.toString())
|
||||
|
||||
const result = await this.AttachmentRemoteDataSourceService.getAttachment(input.attachments[0].id)
|
||||
if(result.isErr()) {
|
||||
const httpResult = await this.AttachmentRemoteDataSourceService.getAttachment(input.attachments[0].id)
|
||||
if(httpResult.isErr()) {
|
||||
tracing.hasError('failed to download message attachment', {
|
||||
error: result.error,
|
||||
error: httpResult.error,
|
||||
data: 'document id '+ input.attachments[0].id,
|
||||
messageId: input.id,
|
||||
$messageId: input.$id
|
||||
})
|
||||
|
||||
if(isHttpResponse(result.error)) {
|
||||
tracing.setAttribute('attachmentUrl', result.error.message)
|
||||
if(isHttpResponse(httpResult.error)) {
|
||||
tracing.setAttribute('attachmentUrl', httpResult.error.message)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(result.isOk()) {
|
||||
if(httpResult.isOk()) {
|
||||
|
||||
const dataUrl = await createBlobUrl(result.value)
|
||||
const dataUrl = await createBlobUrl(httpResult.value.data)
|
||||
|
||||
if(dataUrl.isOk()) {
|
||||
|
||||
@@ -92,7 +92,7 @@ export class MessageAttachmentByMessageIdUseCase {
|
||||
|
||||
this.AttachmentLocalDataSource.insert({
|
||||
$messageId: input.$id,
|
||||
file: result.value,
|
||||
file: httpResult.value.data,
|
||||
fileType: input.attachments[0].fileType,
|
||||
source: input.attachments[0].source,
|
||||
fileName: input.attachments[0].fileName,
|
||||
@@ -110,13 +110,13 @@ export class MessageAttachmentByMessageIdUseCase {
|
||||
|
||||
return dataUrl
|
||||
} else {
|
||||
console.log('dataUrl eerror', dataUrl.error)
|
||||
console.log('dataUrl eerror', dataUrl.error, 'url:,', httpResult.value)
|
||||
return err(false)
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
return result as any
|
||||
return httpResult as any
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-4
@@ -31,10 +31,10 @@ export class DownloadMessageAttachmentUserCaseService {
|
||||
|
||||
if(validation.isOk()) {
|
||||
|
||||
const result = await this.AttachmentRemoteDataSourceService.getAttachment(input.id)
|
||||
return result.asyncMap(async (blob) => {
|
||||
const httpResult = await this.AttachmentRemoteDataSourceService.getAttachment(input.id)
|
||||
return httpResult.asyncMap(async (response) => {
|
||||
|
||||
const dataUrl = await createBlobUrl(blob)
|
||||
const dataUrl = await createBlobUrl(response.data)
|
||||
|
||||
if(dataUrl.isOk()) {
|
||||
|
||||
@@ -46,7 +46,7 @@ export class DownloadMessageAttachmentUserCaseService {
|
||||
this.AttachmentLocalDataSource.insert({
|
||||
$messageId: input.$messageId,
|
||||
id: input.id,
|
||||
file: blob,
|
||||
file: response.data,
|
||||
})
|
||||
|
||||
return dataUrl.value
|
||||
|
||||
@@ -27,6 +27,7 @@ export class MessageLocalGetByIdService {
|
||||
})
|
||||
}
|
||||
else if(input.roomId) {
|
||||
console.log('find(')
|
||||
return this.messageLocalRepository.find({roomId: input.roomId})
|
||||
} else if (input.receiverId) {
|
||||
return this.messageLocalRepository.find({receiverId: parseInt(input.receiverId)})
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ export class MessageMarkAsReadUseCaseService {
|
||||
) { }
|
||||
|
||||
|
||||
@XTracerAsync({name:'MessageMarkAsReadUseCaseService', module:'chat', bugPrint: true})
|
||||
@XTracerAsync({name:'MessageMarkAsReadUseCaseService', module:'chat', bugPrint: true, waitNThrow: 5000})
|
||||
async execute(sendReadAt: MessageMarkAsReadInput, tracing?: TracingType) {
|
||||
const result = await this.MessageSocketRepositoryService.sendReadAt(sendReadAt as any)
|
||||
|
||||
|
||||
@@ -105,31 +105,25 @@ export class RoomBoldSyncUseCaseService {
|
||||
|
||||
const room = await this.roomLocalDataSourceService.findOne({id: roomId})
|
||||
|
||||
if(room.isOk() && room.value) {
|
||||
const roomEntity = new RoomEntity(room.value)
|
||||
if (roomEntity.hasLastMessage()) {
|
||||
const message = Object.assign(new MessageEntity(), loadHistoryFirstMessage)
|
||||
const haveSeen = message.haveSeen()
|
||||
|
||||
const message = Object.assign(new MessageEntity(), roomEntity.messages[0])
|
||||
const haveSeen = message.haveSeen()
|
||||
if(haveSeen ===false && message.meSender() == false) {
|
||||
await this.boldLocalRepository.open()
|
||||
const result = await this.boldLocalRepository.findOne({roomId: roomId})
|
||||
|
||||
if(!haveSeen && !message.meSender()) {
|
||||
await this.boldLocalRepository.open()
|
||||
const result = await this.boldLocalRepository.findOne({roomId: roomEntity.id})
|
||||
|
||||
if(result.isOk() && !result.value) {
|
||||
const result = await this.boldLocalRepository.insert({roomId: roomEntity.id, bold: 1})
|
||||
} else if(result.isOk() && result.value.bold == 0) {
|
||||
const result = await this.boldLocalRepository.update(roomEntity.id, {bold: 1})
|
||||
} else {
|
||||
// tracing.hasError("failed to set bold",{})
|
||||
}
|
||||
} else {
|
||||
const result = await this.boldLocalRepository.update(roomEntity.id, {bold: 0})
|
||||
}
|
||||
if(result.isOk() && !result.value) {
|
||||
const result = await this.boldLocalRepository.insert({roomId: roomId, bold: 1})
|
||||
} else if(result.isOk() && result.value.bold == 0) {
|
||||
const result = await this.boldLocalRepository.update(roomId, {bold: 1})
|
||||
} else {
|
||||
// tracing.hasError("failed to set bold",{})
|
||||
}
|
||||
|
||||
} else {
|
||||
const result = await this.boldLocalRepository.update(roomId, {bold: 0})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import { GetRoomByIdMapper } from 'src/app/core/chat/mapper/getRoomByIdMapper';
|
||||
import { RoomEntity, RoomType } from 'src/app/core/chat/entity/group';
|
||||
import { diff, addedDiff, deletedDiff, updatedDiff, detailedDiff } from 'deep-object-diff';
|
||||
import { zodSafeValidation } from 'src/app/utils/zodValidation';
|
||||
import { CronJobService } from 'src/app/utils/task-scheduler'
|
||||
|
||||
const UserSchema = z.object({
|
||||
wxUserId: z.number(),
|
||||
@@ -54,13 +55,13 @@ export class GetRoomByIdUseCaseService {
|
||||
constructor(
|
||||
private roomRemoteDataSourceService: IRoomRemoteRepository,
|
||||
private roomLocalDataSourceService: IRoomLocalRepository,
|
||||
private MemberListLocalRepository: IMemberLocalRepository
|
||||
private MemberListLocalRepository: IMemberLocalRepository,
|
||||
private CronJobService: CronJobService
|
||||
) { }
|
||||
|
||||
@captureAndReraiseAsync('RoomRepositoryService/getRoomById')
|
||||
async execute(id: RoomByIdInputDTO) {
|
||||
|
||||
console.log('iiiiiiiiiiii', id)
|
||||
const result = await this.roomRemoteDataSourceService.getRoom(id)
|
||||
|
||||
if(result.isOk()) {
|
||||
@@ -92,16 +93,30 @@ export class GetRoomByIdUseCaseService {
|
||||
|
||||
} else if (getRoomById.isOk() && !getRoomById.value) {
|
||||
const room = GetRoomByIdMapper.toDomain(validData.value)
|
||||
this.roomLocalDataSourceService.insert(room)
|
||||
const createResult = await this.roomLocalDataSourceService.insert(room)
|
||||
|
||||
if(createResult.isErr()) {
|
||||
console.error('createResultErr', createResult.error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(validData.value.data.expirationDate) {
|
||||
this.CronJobService.createCronJob(`remove expired room ${id}`, new Date(validData.value.data.expirationDate), () => {
|
||||
setTimeout(() => {
|
||||
this.execute(id);
|
||||
}, 60000);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else if (isHttpResponse(result.error) ) {
|
||||
if(result.error.status == 404) {
|
||||
await this.roomLocalDataSourceService.delete(id)
|
||||
|
||||
+19
-5
@@ -1,6 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { GetRoomListUseCaseService } from './room-get-list-use-case.service'
|
||||
import { RoomSocketRepositoryService } from '../../../data/repository/room/room-socket-repository.service'
|
||||
import { IRoomLocalRepository } from 'src/app/core/chat/repository/room/room-local-repository';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -9,7 +10,8 @@ export class RoomGetListOnCreateUseCaseService {
|
||||
|
||||
constructor(
|
||||
private RoomSocketRepositoryService: RoomSocketRepositoryService,
|
||||
private getRoomListUseCaseService: GetRoomListUseCaseService
|
||||
private getRoomListUseCaseService: GetRoomListUseCaseService,
|
||||
private roomLocalDataSourceService: IRoomLocalRepository,
|
||||
) {
|
||||
this.init()
|
||||
}
|
||||
@@ -21,10 +23,22 @@ export class RoomGetListOnCreateUseCaseService {
|
||||
}
|
||||
|
||||
|
||||
private OnReceiveCreateRoom() {
|
||||
this.RoomSocketRepositoryService.listenToCreateRoom().subscribe((data)=> {
|
||||
console.log('OnReceiveCreateRoom', data)
|
||||
this.getRoomListUseCaseService.execute()
|
||||
private async OnReceiveCreateRoom() {
|
||||
this.RoomSocketRepositoryService.listenToCreateRoom().subscribe(async(data)=> {
|
||||
|
||||
setTimeout(async () => {
|
||||
const findLocally = await this.roomLocalDataSourceService.findOne({id:(data.data as any).id})
|
||||
|
||||
if(findLocally.isOk() && !findLocally.value) {
|
||||
this.getRoomListUseCaseService.execute()
|
||||
}
|
||||
|
||||
}, 1000);
|
||||
|
||||
|
||||
// const result = await this.roomRemoteDataSourceService.getRoom(id)
|
||||
// console.log('OnReceiveCreateRoom', data)
|
||||
//this.getRoomListUseCaseService.execute()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ export class GetRoomListUseCaseService {
|
||||
|
||||
@captureAndReraiseAsync('RoomRepositoryService/list')
|
||||
async execute() {
|
||||
console.log('update===============')
|
||||
const result = await this.roomRemoteDataSourceService.getRoomList()
|
||||
|
||||
const localList = await this.roomLocalDataSourceService.findAll()
|
||||
@@ -108,22 +109,44 @@ export class GetRoomListUseCaseService {
|
||||
}
|
||||
|
||||
} else {
|
||||
this.roomLocalDataSourceService.insert(room)
|
||||
const createResult = this.roomLocalDataSourceService.insert(room)
|
||||
|
||||
createResult.then((result) => {
|
||||
if(result.isErr()) {
|
||||
console.log('error', result.error)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if(room.expirationDate) {
|
||||
this.CronJobService.createCronJob('remove expired room', new Date(room.expirationDate), this.execute)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const roomsToUpdateEntity = GetRoomListMapper.toDomain(roomsToUpdate)
|
||||
this.roomLocalDataSourceService.updateMany(roomsToUpdateEntity)
|
||||
if(roomsToUpdate.length >= 1) {
|
||||
const roomsToUpdateEntity = GetRoomListMapper.toDomain(roomsToUpdate)
|
||||
this.roomLocalDataSourceService.updateMany(roomsToUpdateEntity)
|
||||
}
|
||||
|
||||
for( const room of roomsToDelete) {
|
||||
if(room.local == IDBoolean.false) {
|
||||
this.roomLocalDataSourceService.delete(room.id)
|
||||
const findResult = this.roomLocalDataSourceService.findOne({id:room.id})
|
||||
findResult.then((result) => {
|
||||
if(result.isOk() && result.value) {
|
||||
this.roomLocalDataSourceService.delete(result.value.$id)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for(const room of filterValidateRooms) {
|
||||
if(room.chatRoom.expirationDate) {
|
||||
|
||||
|
||||
this.CronJobService.createCronJob('remove expired room list', new Date(room.chatRoom.expirationDate), () => {
|
||||
setTimeout(() => {
|
||||
this.execute();
|
||||
}, 60000);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user