Skip to content

Commit

Permalink
member view update
Browse files Browse the repository at this point in the history
  • Loading branch information
armintalaie committed Sep 28, 2024
1 parent be0a557 commit dee2cbf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/app/portal/admin/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export default function Layout({ children }: { children: React.ReactNode }) {
redirect("/auth");
}


if (
!userMetadata ||
!userMetadata.roles ||
Expand Down
9 changes: 8 additions & 1 deletion src/app/portal/admin/members/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@ function createColumns<TData>(fields: any[]): ColumnDef<keyof FormFields>[] {
export default function MembersDatabase() {
const { members, error, isLoading } = useMembers({ filters: {} });
const config = {
columnOrder: ["firstName", "lastName", "email", "teams"],
columnOrder: [
"firstName",
"lastName",
"email",
"teams",
"discordId",
"githubUsername",
],
};
if (isLoading) {
return <Loading />;
Expand Down
6 changes: 4 additions & 2 deletions src/app/portal/api/v1/members/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function GET(request: NextRequest) {
const members = res.map((r) => {
const teams = r.team_members.map((tm) => {
return {
id: Number(tm.team_id),
// id: Number(tm.team_id),
role: tm.role,
name: tm.teams.name,
startYear: tm.teams.start_year,
Expand All @@ -31,13 +31,15 @@ export async function GET(request: NextRequest) {
});

return {
id: r.id,
// id: r.id,
firstName: r.first_name,
lastName: r.last_name,
email: r.users.email,
specialization: r.specialization,
faculty: r.faculty,
team: r.team_members[0].teams.name,
discordId: r.discord_id,
githubUsername: r.github_username,
};
});

Expand Down

0 comments on commit dee2cbf

Please sign in to comment.