mirror of
https://github.com/MrSedan/neuro-reply-website.git
synced 2026-01-14 20:49:42 +03:00
Returning user_name in get admins
This commit is contained in:
@@ -11,8 +11,12 @@ export class AdminService {
|
|||||||
async getAdmins() {
|
async getAdmins() {
|
||||||
try {
|
try {
|
||||||
this.logger.debug(`[admin.getAdmins]`);
|
this.logger.debug(`[admin.getAdmins]`);
|
||||||
const admins = await this.adminRepository.find();
|
const admins = await this.adminRepository.find({ relations: { user: true }, select: { user_id: true, user: { user_name: true } } });
|
||||||
return admins;
|
const result: { user_id: string; user_name: string }[] = admins.map((admin) => ({
|
||||||
|
user_id: admin.user_id,
|
||||||
|
user_name: admin.user.user_name,
|
||||||
|
}));
|
||||||
|
return result;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.log(`[getAdmin] ${JSON.stringify({ error })}`);
|
this.logger.log(`[getAdmin] ${JSON.stringify({ error })}`);
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
Reference in New Issue
Block a user