chore: updated user resolver with updated service methods
This commit is contained in:
@@ -2,6 +2,8 @@ import { Parent, ResolveField, Resolver } from '@nestjs/graphql';
|
||||
import { User } from 'src/user/user.model';
|
||||
import { UserEnvironment } from './user-environments.model';
|
||||
import { UserEnvironmentsService } from './user-environments.service';
|
||||
import * as E from 'fp-ts/Either';
|
||||
import { throwErr } from '../utils';
|
||||
|
||||
@Resolver(() => User)
|
||||
export class UserEnvsUserResolver {
|
||||
@@ -20,8 +22,9 @@ export class UserEnvsUserResolver {
|
||||
async globalEnvironments(
|
||||
@Parent() user: User,
|
||||
): Promise<UserEnvironment | string> {
|
||||
return await this.userEnvironmentsService.fetchUserGlobalEnvironments(
|
||||
user.uid,
|
||||
);
|
||||
const userEnvironment =
|
||||
await this.userEnvironmentsService.fetchUserGlobalEnvironment(user.uid);
|
||||
if (E.isLeft(userEnvironment)) throwErr(userEnvironment.left);
|
||||
return userEnvironment.right;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user