add contacts

This commit is contained in:
Peter Maquiran
2024-06-10 16:34:43 +01:00
parent 193e7474e9
commit bf1457417d
23 changed files with 348 additions and 481 deletions
@@ -7,6 +7,7 @@ import { Observable } from 'rxjs';
import { RoomOutPutDTO } from '../../dto/room/roomOutputDTO';
import { z } from 'zod';
import { MessageInputDTO } from '../../dto/message/messageInputDtO';
import { SessionStore } from 'src/app/store/session.service';
const tableSchema = z.object({
@@ -51,7 +52,6 @@ export class MessageLocalDataSourceService {
async createMessage(data: MessageInputDTO) {
try {
console.log('add', data)
const result = await messageDataSource.message.add(data)
return ok(result as string)
} catch (e) {
@@ -65,7 +65,6 @@ export class MessageLocalDataSourceService {
async update(data: TableMessage) {
try {
console.log('update', data)
const result = await messageDataSource.message.update(data.id, data)
return ok(result)
} catch (e) {
@@ -78,8 +77,6 @@ export class MessageLocalDataSourceService {
async findOrUpdate(data: TableMessage) {
const findResult = await this.findMessageById(data.messageId)
console.log('findOrUpdate', findResult)
if(findResult.isOk()) {
return this.update({...findResult.value, ...data})
} else {
@@ -87,8 +84,8 @@ export class MessageLocalDataSourceService {
}
}
getItemsLive(roomId: string): Observable<RoomListOutPutDTO> {
return liveQuery(() => messageDataSource.message.where('roomId').equals(roomId).toArray() as any) as any
getItemsLive(roomId: string) {
return liveQuery(() => messageDataSource.message.where('roomId').equals(roomId).toArray() )
}