Fix teamRole showing.

This commit is contained in:
Brian Cao 2023-09-06 11:37:41 -07:00
parent f2f5517051
commit c5dd3390d6
3 changed files with 17 additions and 4 deletions

View File

@ -29,7 +29,9 @@ export function TeamMembersTable({
} }
if (key === 'role') { if (key === 'role') {
return formatMessage( return formatMessage(
labels[Object.keys(ROLES).find(key => ROLES[key] === row.role) || labels.unknown], labels[
Object.keys(ROLES).find(key => ROLES[key] === row?.teamUser[0]?.role) || labels.unknown
],
); );
} }
return data[key]; return data[key];

View File

@ -22,8 +22,8 @@ const schema = {
}), }),
POST: yup.object().shape({ POST: yup.object().shape({
id: yup.string().uuid().required(), id: yup.string().uuid().required(),
name: yup.string().max(50).required(), name: yup.string().max(50),
accessCode: yup.string().max(50).required(), accessCode: yup.string().max(50),
}), }),
DELETE: yup.object().shape({ DELETE: yup.object().shape({
id: yup.string().uuid().required(), id: yup.string().uuid().required(),

View File

@ -97,7 +97,18 @@ export async function getUsers(
} }
export async function getUsersByTeamId(teamId: string, filter?: UserSearchFilter) { export async function getUsersByTeamId(teamId: string, filter?: UserSearchFilter) {
return getUsers({ teamId, ...filter }); return getUsers(
{ teamId, ...filter },
{
include: {
teamUser: {
select: {
role: true,
},
},
},
},
);
} }
export async function createUser(data: { export async function createUser(data: {