mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
add opentelemetr logging
This commit is contained in:
@@ -8,20 +8,20 @@ import { SignalRService } from '../../../infra/socket/signal-r.service';
|
||||
export class MessageLiveDataSourceService {
|
||||
|
||||
constructor(
|
||||
public socket: WebSocketService,
|
||||
// public socket: WebSocketService,
|
||||
private signalR: SignalRService) {}
|
||||
|
||||
async sendMessage(data: WebSocketMessage) {
|
||||
// async sendMessage(data: WebSocketMessage) {
|
||||
|
||||
try {
|
||||
// // try {
|
||||
|
||||
const result = await this.socket.sendMessage(data).toPromise()
|
||||
// // const result = await this.socket.sendMessage(data).toPromise()
|
||||
|
||||
return ok(result)
|
||||
} catch (e) {
|
||||
return err(e)
|
||||
}
|
||||
// // return ok(result)
|
||||
// // } catch (e) {
|
||||
// // return err(e)
|
||||
// // }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -7,21 +7,21 @@ import { err, ok } from 'neverthrow';
|
||||
})
|
||||
export class RoomLiveDataSourceService {
|
||||
|
||||
constructor(private socket: WebSocketService) {}
|
||||
// constructor(private socket: WebSocketService) {}
|
||||
|
||||
async getRoomById(data: WebSocketMessage) {
|
||||
// async getRoomById(data: WebSocketMessage) {
|
||||
|
||||
try {
|
||||
// try {
|
||||
|
||||
const result = await this.socket.sendMessage(data).toPromise()
|
||||
// const result = await this.socket.sendMessage(data).toPromise()
|
||||
|
||||
console.log({result})
|
||||
// console.log({result})
|
||||
|
||||
return ok(result)
|
||||
} catch (e) {
|
||||
return err(e)
|
||||
}
|
||||
// return ok(result)
|
||||
// } catch (e) {
|
||||
// return err(e)
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import { UserRemoveListInputDTO, UserRemoveListInputDTOSchema } from '../../dto/
|
||||
import { RoomUpdateInputDTO, RoomUpdateInputDTOSchema } from '../../dto/room/roomUpdateInputDTO';
|
||||
import { RoomUpdateOutputDTO } from '../../dto/room/roomUpdateOutputDTO';
|
||||
import { DataSourceReturn } from 'src/app/services/Repositorys/type';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -33,7 +34,7 @@ export class RoomRemoteDataSourceService {
|
||||
|
||||
@APIReturn(RoomListOutPutDTOSchema, 'get/Room')
|
||||
async getRoomList(): Promise<DataSourceReturn<RoomListOutPutDTO>> {
|
||||
return await this.httpService.get<RoomListOutPutDTO>(`${this.baseUrl}/Room`);
|
||||
return await this.httpService.get<RoomListOutPutDTO>(`${this.baseUrl}/Room?userId=${SessionStore.user.UserId}`);
|
||||
}
|
||||
|
||||
@ValidateSchema(RoomByIdInputDTOSchema)
|
||||
|
||||
@@ -22,12 +22,12 @@ export class MessageRepositoryService {
|
||||
private messageLiveSignalRDataSourceService: SignalRService,
|
||||
private messageLocalDataSourceService: MessageLocalDataSourceService
|
||||
) {
|
||||
this.messageLiveDataSourceService.socket.messages$.subscribe(({payload, requestId, type}) => {
|
||||
// this.messageLiveDataSourceService.socket.messages$.subscribe(({payload, requestId, type}) => {
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
@@ -44,10 +44,10 @@ export class MessageRepositoryService {
|
||||
|
||||
const localActionResult = await this.messageLocalDataSourceService.sendMessage(data)
|
||||
|
||||
this.messageLiveDataSourceService.sendMessage({
|
||||
type: 'sendMessage',
|
||||
payload: data
|
||||
})
|
||||
// this.messageLiveDataSourceService.sendMessage({
|
||||
// type: 'sendMessage',
|
||||
// payload: data
|
||||
// })
|
||||
|
||||
if(localActionResult.isOk()) {
|
||||
|
||||
|
||||
@@ -170,10 +170,10 @@ export class RoomRepositoryService {
|
||||
if(result.isOk()) {
|
||||
|
||||
const result = await this.roomLocalDataSourceService.deleteRoomById(id)
|
||||
this.messageLiveDataSourceService.sendMessage({
|
||||
type: 'createRoom',
|
||||
payload: {a: '5'}
|
||||
})
|
||||
// this.messageLiveDataSourceService.sendMessage({
|
||||
// type: 'createRoom',
|
||||
// payload: {a: '5'}
|
||||
// })
|
||||
|
||||
return result
|
||||
} else if (isHttpResponse(result.error)) {
|
||||
@@ -216,10 +216,10 @@ export class RoomRepositoryService {
|
||||
// this.roomMemoryDataSourceService.dispatch(addRoom(result.value))
|
||||
const localResult = await this.roomLocalDataSourceService.createRoom(result.value.data)
|
||||
|
||||
this.messageLiveDataSourceService.sendMessage({
|
||||
type: 'createRoom',
|
||||
payload: {a: '5'}
|
||||
})
|
||||
// this.messageLiveDataSourceService.sendMessage({
|
||||
// type: 'createRoom',
|
||||
// payload: {a: '5'}
|
||||
// })
|
||||
|
||||
return localResult.map(e => result.value)
|
||||
}
|
||||
|
||||
@@ -33,16 +33,16 @@ export class WebSocketService {
|
||||
this.messageSubject$ = new Subject<WebSocketMessage>();
|
||||
this.connectionStatus$ = new BehaviorSubject<boolean>(false);
|
||||
|
||||
this.connect('https://5-180-182-151.cloud-xip.com:85/ws/')
|
||||
// this.connect('https://5-180-182-151.cloud-xip.com:85/ws/')
|
||||
|
||||
this.messages$.subscribe(({payload, requestId, type}) => {
|
||||
if(this.callback[requestId]) {
|
||||
this.callback[requestId]({payload, requestId, type})
|
||||
delete this.callback[requestId]
|
||||
// this.messages$.subscribe(({payload, requestId, type}) => {
|
||||
// if(this.callback[requestId]) {
|
||||
// this.callback[requestId]({payload, requestId, type})
|
||||
// delete this.callback[requestId]
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
public connect(url: string) {
|
||||
|
||||
Reference in New Issue
Block a user