contactList chat done

This commit is contained in:
Eudes Inácio
2024-06-05 10:32:56 +01:00
parent 39f89a92a5
commit b38a4e4112
4 changed files with 114 additions and 65 deletions
@@ -0,0 +1,34 @@
import { Injectable } from '@angular/core';
import { HttpService } from 'src/app/services/http.service';
import { MessageOutPutDTO } from '../../chat/dto/message/messageOutputDTO';
import { MessageListInputDTO } from '../../chat/dto/message/messageListInputDTO';
import { DataSourceReturn } from '../../type';
export interface UserContacts {
wxUserId: number;
wxFullName: string;
wxeMail: string | null;
userPhoto: string | null;
}
export interface UserList {
success: boolean;
message: string;
data: UserContacts[];
}
@Injectable({
providedIn: 'root'
})
export class ContactsDataSourceService {
private baseUrl = 'https://gdapi-dev.dyndns.info/stage/api/v2'; // Your base URL
constructor(private httpService: HttpService) {}
async getUsers() {
return await this.httpService.get<UserList>(`${this.baseUrl}/Users`);
}
}
@@ -0,0 +1,18 @@
import { Injectable } from '@angular/core';
import { ContactsDataSourceService } from '../data-source/contacts-data-source.service';
@Injectable({
providedIn: 'root'
})
export class ContactRepositoryService {
constructor(
private constactsDataSourceService: ContactsDataSourceService,
) {}
async getUsers() {
const result = await this.constactsDataSourceService.getUsers();
return result;
}
}