mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
add documentation and remove console logs
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
```js
|
||||||
|
export const BoldTableSchema = z.object({
|
||||||
|
roomId: z.string(),
|
||||||
|
bold: z.number()
|
||||||
|
})
|
||||||
|
|
||||||
|
export type DexieBoldTable = EntityTable<BoldTable, 'roomId'>;
|
||||||
|
export const BoldTableColumn = 'roomId, bold';
|
||||||
|
|
||||||
|
```
|
||||||
@@ -14,7 +14,7 @@ import { DexieUserPhotoTable, UserPhotoTable, UserPhotoTableColumn } from './ins
|
|||||||
|
|
||||||
|
|
||||||
// Database declaration (move this to its own module also)
|
// Database declaration (move this to its own module also)
|
||||||
export const chatDatabase = new Dexie('chat-database-v2',{
|
export const chatDatabase = new Dexie('chat-database-v3',{
|
||||||
// indexedDB: new FDBFactory,
|
// indexedDB: new FDBFactory,
|
||||||
// IDBKeyRange: FDBKeyRange, // Mocking IDBKeyRange
|
// IDBKeyRange: FDBKeyRange, // Mocking IDBKeyRange
|
||||||
}) as Dexie & {
|
}) as Dexie & {
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ export class RoomBoldSyncUseCaseService {
|
|||||||
this.loadHistory()
|
this.loadHistory()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @description listen to all incoming message and set bold to true
|
||||||
|
*/
|
||||||
private listenToIncomingMessage() {
|
private listenToIncomingMessage() {
|
||||||
return this.MessageSocketRepositoryService.listenToMessages().pipe(
|
return this.MessageSocketRepositoryService.listenToMessages().pipe(
|
||||||
filter((message) => !message?.requestId?.startsWith(InstanceId)),
|
filter((message) => !message?.requestId?.startsWith(InstanceId)),
|
||||||
@@ -51,6 +55,10 @@ export class RoomBoldSyncUseCaseService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @description Listen to all update message. If the incoming updated message has readAt my me and is the last message then remove bold
|
||||||
|
*/
|
||||||
private listenToUpdateMessages() {
|
private listenToUpdateMessages() {
|
||||||
return this.MessageSocketRepositoryService.listenToUpdateMessages().pipe(
|
return this.MessageSocketRepositoryService.listenToUpdateMessages().pipe(
|
||||||
filter((message) => !message?.requestId?.startsWith(InstanceId)),
|
filter((message) => !message?.requestId?.startsWith(InstanceId)),
|
||||||
@@ -77,6 +85,9 @@ export class RoomBoldSyncUseCaseService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description set bold base on the last message on load history. If the last message has readAt by me then remove bold in case not set bold
|
||||||
|
*/
|
||||||
@XTracerAsync({name:'RoomBoldSyncUseCaseService/loadHistory', module:'chat', bugPrint: true})
|
@XTracerAsync({name:'RoomBoldSyncUseCaseService/loadHistory', module:'chat', bugPrint: true})
|
||||||
private loadHistory() {
|
private loadHistory() {
|
||||||
const regex = new RegExp("Room\\/([0-9a-fA-F]{8})-([0-9a-fA-F]{4})-([0-9a-fA-F]{4})-([0-9a-fA-F]{4})-([0-9a-fA-F]{12})\\/Messages");
|
const regex = new RegExp("Room\\/([0-9a-fA-F]{8})-([0-9a-fA-F]{4})-([0-9a-fA-F]{4})-([0-9a-fA-F]{4})-([0-9a-fA-F]{12})\\/Messages");
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ export class RoomSetLastMessageService {
|
|||||||
|
|
||||||
const room = await this.roomLocalRepository.findOne({id: roomId})
|
const room = await this.roomLocalRepository.findOne({id: roomId})
|
||||||
|
|
||||||
if(room.isOk()) {
|
if(room.isOk() && room.value) {
|
||||||
const roomEntity = new RoomEntity(room.value)
|
const roomEntity = new RoomEntity(room.value)
|
||||||
if(!roomEntity.hasLastMessage()) {
|
if(!roomEntity.hasLastMessage()) {
|
||||||
await this.roomLocalRepository.update(loadHistoryFirstMessage.roomId, {
|
await this.roomLocalRepository.update(loadHistoryFirstMessage.roomId, {
|
||||||
@@ -219,6 +219,8 @@ export class RoomSetLastMessageService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.log('cant find room locally')
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,17 +178,17 @@ export class ContactsPage implements OnInit {
|
|||||||
|
|
||||||
if(room.isOk()) {
|
if(room.isOk()) {
|
||||||
|
|
||||||
console.log('room', room)
|
|
||||||
console.log('result.value', result.value)
|
|
||||||
console.log('receiverId', user.wxUserId)
|
|
||||||
|
|
||||||
// await this.chatServiceService.getRoomById(user.wxUserId.toString())
|
|
||||||
this.close(user.wxUserId.toString())
|
|
||||||
this.openMessageComponent(new RoomViewModel(room.value))
|
this.openMessageComponent(new RoomViewModel(room.value))
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.close(user.wxUserId.toString())
|
const room = await this.chatServiceService.roomGetLocalById({
|
||||||
|
$roomId: user.wxUserId.toString()
|
||||||
|
})
|
||||||
|
|
||||||
|
if(room.isOk()) {
|
||||||
|
this.openMessageComponent(new RoomViewModel(room.value))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
export let versionData = {
|
export let versionData = {
|
||||||
"shortSHA": "01c2f5efb",
|
"shortSHA": "8d332f73a",
|
||||||
"SHA": "01c2f5efb5fa836decbc130ca5dcb8a8b6634d94",
|
"SHA": "8d332f73a8dafc3ea98b2eb8e35322d89d185883",
|
||||||
"branch": "feature/chat-new-api-peter",
|
"branch": "feature/chat-new-api-peter",
|
||||||
"lastCommitAuthor": "'Peter Maquiran'",
|
"lastCommitAuthor": "'Peter Maquiran'",
|
||||||
"lastCommitTime": "'Wed Sep 18 11:47:23 2024 +0100'",
|
"lastCommitTime": "'Wed Sep 18 12:32:31 2024 +0100'",
|
||||||
"lastCommitMessage": "fix direct room",
|
"lastCommitMessage": "fix bold",
|
||||||
"lastCommitNumber": "6079",
|
"lastCommitNumber": "6080",
|
||||||
"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/core/chat/entity/group.ts\n\tmodified: src/app/core/chat/entity/message.ts\n\tmodified: src/app/module/chat/data/async/list/rooms/roomListChangeDetector.ts\n\tmodified: src/app/module/chat/domain/use-case/room/room-bold-sync-use-case.service.ts\n\tmodified: src/app/ui/chat/component/messages/messages.page.ts",
|
"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\tnew file: doc/database.md\n\tmodified: src/app/infra/database/dexie/service.ts\n\tmodified: src/app/module/chat/domain/use-case/room/room-bold-sync-use-case.service.ts\n\tmodified: src/app/module/chat/domain/use-case/room/room-set-last-message.service.ts\n\tmodified: src/app/ui/chat/component/contacts/contacts.page.ts",
|
||||||
"changeAuthor": "peter.maquiran"
|
"changeAuthor": "peter.maquiran"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user