clear chat connection

This commit is contained in:
Peter Maquiran
2024-09-13 15:33:40 +01:00
parent e0bd6fdf44
commit ed1b0c01d7
4 changed files with 27 additions and 8 deletions
+2
View File
@@ -25,4 +25,6 @@ export abstract class IDexieRepository<T, R, I = EntityTable<any, any>> {
abstract findAll(): Promise<RepositoryResult<T[], T>>
abstract count(filter?: Object): Promise<RepositoryResult<number, T>>
abstract clear(): Promise<Result<any, any>>
}
@@ -253,4 +253,13 @@ export class DexieRepository<T, R, I = EntityTable<any, any>> implements IDexieR
}))
}
}
async clear() {
try {
const result = await this.table.clear()
return ok(result)
} catch (e) {
return err(false)
}
}
}
+10 -2
View File
@@ -19,6 +19,10 @@ import { Cy } from 'cypress/enum'
import { AgendaDataRepositoryService } from 'src/app/module/agenda/data/repository/agenda-data-repository.service';
import { NotificationRepositoryService } from 'src/app/module/notification/data/notification-repository.service'
import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service';
import { chatDatabase } from 'src/app/infra/database/dexie/service';
import { RoomLocalRepository } from 'src/app/module/chat/data/repository/room/room-local-repository.service'
import { MessageLocalDataSourceService } from 'src/app/module/chat/data/repository/message/message-local-data-source.service'
@Component({
selector: 'app-login',
@@ -58,7 +62,9 @@ export class LoginPage implements OnInit {
private NotificationHolderService: NotificationHolderService,
public AgendaDataRepositoryService: AgendaDataRepositoryService,
private NotificationRepositoryService: NotificationRepositoryService,
private ChatServiceService: ChatServiceService
private ChatServiceService: ChatServiceService,
private RoomLocalRepository: RoomLocalRepository,
private MessageLocalDataSourceService: MessageLocalDataSourceService
) { }
@@ -170,8 +176,10 @@ export class LoginPage implements OnInit {
} else {
await this.RoomLocalRepository.clear()
await this.MessageLocalDataSourceService.clear()
await this.NotificationRepositoryService.clearData()
this.ChatServiceService.start()
await this.AgendaDataRepositoryService.clearSharedCalendar()
+6 -6
View File
@@ -1,11 +1,11 @@
export let versionData = {
"shortSHA": "5c755b71a",
"SHA": "5c755b71ac7a384ea270b7f60a0d8308bbc3c6e3",
"shortSHA": "e0bd6fdf4",
"SHA": "e0bd6fdf44eb7f2913357e9b8d1cc48c0a8866b7",
"branch": "feature/chat-new-api-peter",
"lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Fri Sep 13 15:11:22 2024 +0100'",
"lastCommitMessage": "remove console .log",
"lastCommitNumber": "6071",
"changeStatus": "On branch feature/chat-new-api-peter\nYour branch is up to date with 'origin/feature/chat-new-api-peter'.\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts",
"lastCommitTime": "'Fri Sep 13 15:14:59 2024 +0100'",
"lastCommitMessage": "remove static",
"lastCommitNumber": "6072",
"changeStatus": "On branch feature/chat-new-api-peter\nYour branch is up to date with 'origin/feature/chat-new-api-peter'.\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/infra/repository/adapter.ts\n\tmodified: src/app/infra/repository/dexie/dexie-repository.service.ts\n\tmodified: src/app/pages/login/login.page.ts\n\tmodified: version/git-version.ts",
"changeAuthor": "peter.maquiran"
}