Remove admin role alias from Teams auth
This commit is contained in:
@@ -24,7 +24,6 @@ export const userTypeDefs = `#graphql
|
|||||||
phone: String
|
phone: String
|
||||||
avatarId: String
|
avatarId: String
|
||||||
isManager: Boolean
|
isManager: Boolean
|
||||||
isAdmin: Boolean @deprecated(reason: "Use isManager")
|
|
||||||
activeTeamId: String
|
activeTeamId: String
|
||||||
activeTeam: UserTeam
|
activeTeam: UserTeam
|
||||||
teams: [UserTeam]
|
teams: [UserTeam]
|
||||||
@@ -63,7 +62,7 @@ export const userTypeDefs = `#graphql
|
|||||||
code: String!
|
code: String!
|
||||||
}
|
}
|
||||||
|
|
||||||
input AdminTotpLoginInput {
|
input ManagerTotpLoginInput {
|
||||||
phone: String!
|
phone: String!
|
||||||
code: String!
|
code: String!
|
||||||
}
|
}
|
||||||
@@ -126,7 +125,7 @@ export const userTypeDefs = `#graphql
|
|||||||
type Mutation {
|
type Mutation {
|
||||||
requestLoginOtp(input: RequestLoginOtpInput!): AuthChallenge!
|
requestLoginOtp(input: RequestLoginOtpInput!): AuthChallenge!
|
||||||
verifyLoginOtp(input: VerifyLoginOtpInput!): AuthPayload!
|
verifyLoginOtp(input: VerifyLoginOtpInput!): AuthPayload!
|
||||||
adminTotpLogin(input: AdminTotpLoginInput!): AuthPayload!
|
managerTotpLogin(input: ManagerTotpLoginInput!): AuthPayload!
|
||||||
logout: Boolean!
|
logout: Boolean!
|
||||||
createTeam(input: CreateTeamInput!): CreateTeamResult
|
createTeam(input: CreateTeamInput!): CreateTeamResult
|
||||||
updateUser(userId: String!, input: UpdateUserInput!): UpdateUserResult
|
updateUser(userId: String!, input: UpdateUserInput!): UpdateUserResult
|
||||||
@@ -193,7 +192,6 @@ async function mapProfileUser(profile: Awaited<ReturnType<typeof getOrCreateProf
|
|||||||
phone: profile.phone,
|
phone: profile.phone,
|
||||||
avatarId: profile.avatarId,
|
avatarId: profile.avatarId,
|
||||||
isManager,
|
isManager,
|
||||||
isAdmin: isManager,
|
|
||||||
activeTeamId: profile.activeTeam?.uuid ?? null,
|
activeTeamId: profile.activeTeam?.uuid ?? null,
|
||||||
activeTeam: profile.activeTeam ? { id: profile.activeTeam.uuid, name: profile.activeTeam.name, teamType: profile.activeTeam.teamType, logtoOrgId: profile.activeTeam.logtoOrgId, createdAt: profile.activeTeam.createdAt.toISOString() } : null,
|
activeTeam: profile.activeTeam ? { id: profile.activeTeam.uuid, name: profile.activeTeam.name, teamType: profile.activeTeam.teamType, logtoOrgId: profile.activeTeam.logtoOrgId, createdAt: profile.activeTeam.createdAt.toISOString() } : null,
|
||||||
teams: memberships.map(m => ({ id: m.team.uuid, name: m.team.name, teamType: m.team.teamType, logtoOrgId: m.team.logtoOrgId, createdAt: m.team.createdAt.toISOString() })),
|
teams: memberships.map(m => ({ id: m.team.uuid, name: m.team.name, teamType: m.team.teamType, logtoOrgId: m.team.logtoOrgId, createdAt: m.team.createdAt.toISOString() })),
|
||||||
@@ -304,7 +302,7 @@ export const userResolvers = {
|
|||||||
return verifyPhoneLogin(args.input.phone, args.input.code)
|
return verifyPhoneLogin(args.input.phone, args.input.code)
|
||||||
},
|
},
|
||||||
|
|
||||||
adminTotpLogin: async (_: unknown, args: { input: { phone: string; code: string } }) => {
|
managerTotpLogin: async (_: unknown, args: { input: { phone: string; code: string } }) => {
|
||||||
return verifyPhoneLogin(args.input.phone, args.input.code)
|
return verifyPhoneLogin(args.input.phone, args.input.code)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user