mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix delete member and add member
This commit is contained in:
@@ -63,34 +63,34 @@ export class RoomEntity extends BaseEntity<RoomEntity>(RoomEntitySchema) implem
|
|||||||
|
|
||||||
if(data.roomType == RoomType.Direct) {
|
if(data.roomType == RoomType.Direct) {
|
||||||
this.setName()
|
this.setName()
|
||||||
}
|
|
||||||
|
|
||||||
if(!this.$id) {
|
if(!this.$id) {
|
||||||
this.setLocalId()
|
this.$id = this.getReceiverId()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!this.receiverId && this.members.length == 2) {
|
||||||
if(this.roomType == RoomType.Direct && !this.receiverId && this.members.length == 2) {
|
this.setReceiver()
|
||||||
this.setReceiver()
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// direct room only
|
||||||
|
getReceiverId() {
|
||||||
|
const receiver = this.members?.find((e) => e.user.wxUserId != SessionStore.user.UserId)
|
||||||
|
return receiver.user.wxUserId.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
// direct room only
|
||||||
setLocalId() {
|
setLocalId() {
|
||||||
const receiver = this.members?.find((e) => e.user.wxUserId != SessionStore.user.UserId)
|
this.$id = this.getReceiverId()
|
||||||
|
|
||||||
if(receiver) {
|
|
||||||
this.$id =receiver.user.wxUserId.toString()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// direct room only
|
||||||
setReceiver() {
|
setReceiver() {
|
||||||
const receiver = this.members?.find((e) => e.user.wxUserId != SessionStore.user.UserId)
|
this.receiverId = parseInt(this.getReceiverId())
|
||||||
|
|
||||||
if(receiver) {
|
|
||||||
this.receiverId = receiver.user.wxUserId
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// direct room only
|
||||||
setName() {
|
setName() {
|
||||||
const userChatName = this.members?.find((e) => e.user.wxUserId != SessionStore.user.UserId)
|
const userChatName = this.members?.find((e) => e.user.wxUserId != SessionStore.user.UserId)
|
||||||
if(userChatName) {
|
if(userChatName) {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export class MemberListRemoteRepository implements IMemberRemoteRepository {
|
|||||||
|
|
||||||
@ValidateSchema(UserRemoveListInputDTOSchema)
|
@ValidateSchema(UserRemoveListInputDTOSchema)
|
||||||
async removeMemberFromRoom(data: UserRemoveListInputDTO): Promise<Result<any ,any>> {
|
async removeMemberFromRoom(data: UserRemoveListInputDTO): Promise<Result<any ,any>> {
|
||||||
return await this.httpService.delete<any>(`${this.baseUrl}/Room/${data.id}/Member`, {members:data.members});
|
return await this.httpService.delete<any>(`${this.baseUrl}/Room/${data.id}/Member`, {} , {members:data.members});
|
||||||
}
|
}
|
||||||
|
|
||||||
async setAmin(data: MemberSetAdminDTO): Promise<Result<any ,any>> {
|
async setAmin(data: MemberSetAdminDTO): Promise<Result<any ,any>> {
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ export class SyncAllRoomMessagesService {
|
|||||||
if (result.isOk()) {
|
if (result.isOk()) {
|
||||||
const { addedItems, changedItems, deletedItems } = messageListDetermineChanges(result.value.data, localResult);
|
const { addedItems, changedItems, deletedItems } = messageListDetermineChanges(result.value.data, localResult);
|
||||||
|
|
||||||
console.log({changedItems})
|
|
||||||
for (const message of changedItems) {
|
for (const message of changedItems) {
|
||||||
|
|
||||||
let clone: MessageTable = { ...message, roomId: room.id };
|
let clone: MessageTable = { ...message, roomId: room.id };
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ export class RoomBoldSyncUseCaseService {
|
|||||||
await this.boldLocalRepository.open()
|
await this.boldLocalRepository.open()
|
||||||
const result = await this.boldLocalRepository.findOne({roomId: newMessage.roomId})
|
const result = await this.boldLocalRepository.findOne({roomId: newMessage.roomId})
|
||||||
|
|
||||||
if(result.isOk() && !result.value?.bold) {
|
if(result.isOk() && !result.value) {
|
||||||
const result = await this.boldLocalRepository.insert({roomId: newMessage.roomId, bold: 1})
|
const result = await this.boldLocalRepository.insert({roomId: newMessage.roomId, bold: 1})
|
||||||
} else if(result.isOk() && result.value.bold == 0) {
|
} else if(result.isOk() && result.value.bold == 0) {
|
||||||
const result = await this.boldLocalRepository.update(newMessage.roomId, {bold: 1})
|
const result = await this.boldLocalRepository.update(newMessage.roomId, {bold: 1})
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export class HttpService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async delete<T>(url: string, httpParamsObj = {}): Promise<Result<T, HttpErrorResponse>> {
|
async delete<T>(url: string, httpParamsObj = {}, body = {}): Promise<Result<T, HttpErrorResponse>> {
|
||||||
|
|
||||||
let httpParams = new HttpParams();
|
let httpParams = new HttpParams();
|
||||||
|
|
||||||
@@ -110,7 +110,8 @@ export class HttpService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let opts = {
|
let opts = {
|
||||||
params : httpParams
|
params : httpParams,
|
||||||
|
body
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -121,7 +122,6 @@ export class HttpService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async patch<T>(url: string, body ={}): Promise<Result<T, HttpErrorResponse>> {
|
async patch<T>(url: string, body ={}): Promise<Result<T, HttpErrorResponse>> {
|
||||||
try {
|
try {
|
||||||
const result = await this.http.patch<T>(url, body).toPromise();
|
const result = await this.http.patch<T>(url, body).toPromise();
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ export class ChatPage implements OnInit {
|
|||||||
this.showMessages = true;
|
this.showMessages = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('conversa não existe');
|
console.log('conversa não existe', $roomId);
|
||||||
// this.toastService._badRequest("Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico.")
|
// this.toastService._badRequest("Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1005,7 +1005,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|||||||
}
|
}
|
||||||
|
|
||||||
openGroupContactsPage() {
|
openGroupContactsPage() {
|
||||||
this.openGroupContacts.emit(this.room.$id);
|
this.openGroupContacts.emit(this.room.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
async takePictureMobile() {
|
async takePictureMobile() {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -8,6 +8,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../sentium"
|
"path": "../sentium"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../GDoc"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
|
|||||||
Reference in New Issue
Block a user