mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
remove expired room
This commit is contained in:
@@ -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})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user