Skip to content

Commit eb765ee

Browse files
committed
base stuff
1 parent 7706e00 commit eb765ee

File tree

6 files changed

+64
-3
lines changed

6 files changed

+64
-3
lines changed

src/common/orgs.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const SIGList = [
1717
"SIGARCH",
1818
"SIGRobotics",
1919
"SIGtricity",
20-
] as const;
20+
] as [string, ...string[]];
2121

2222
export const CommitteeList = [
2323
"Infrastructure Committee",
@@ -26,5 +26,5 @@ export const CommitteeList = [
2626
"Academic Committee",
2727
"Corporate Committee",
2828
"Marketing Committee",
29-
] as const;
30-
export const OrganizationList = ["ACM", ...SIGList, ...CommitteeList];
29+
] as [string, ...string[]];
30+
export const OrganizationList = ["ACM", ...SIGList, ...CommitteeList] as [string, ...string[]];

src/common/roles.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export enum AppRoles {
99
IAM_INVITE_ONLY = "invite:iam",
1010
STRIPE_LINK_CREATOR = "create:stripeLink",
1111
BYPASS_OBJECT_LEVEL_AUTH = "bypass:ola",
12+
ROOM_REQUEST_CREATE = "create:roomRequest",
13+
ROOM_REQUEST_UPDATE = "update:roomRequest"
1214
}
1315
export const allAppRoles = Object.values(AppRoles).filter(
1416
(value) => typeof value === "string",

src/common/types/roomRequest.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { z } from "zod";
2+
import { OrganizationList } from "../orgs";
3+
4+
export const roomRequestPostSchema = z.object({
5+
organization: z.enum(OrganizationList),
6+
name: z.string().min(1),
7+
description: z.string().min(1),
8+
start: z.number().min(0),
9+
end: z.number().min(0).max(604800),
10+
});
11+
12+
export type RoomRequestPostRequest = z.infer<typeof roomRequestPostSchema>;

src/ui/Router.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { ViewTicketsPage } from './pages/tickets/ViewTickets.page';
1919
import { ManageIamPage } from './pages/iam/ManageIam.page';
2020
import { ManageProfilePage } from './pages/profile/ManageProfile.page';
2121
import { ManageStripeLinksPage } from './pages/stripe/ViewLinks.page';
22+
import { ManageRoomRequestsPage } from './pages/roomRequest/RoomRequest.page';
2223

2324
const ProfileRediect: React.FC = () => {
2425
const location = useLocation();
@@ -162,6 +163,10 @@ const authenticatedRouter = createBrowserRouter([
162163
path: '/stripe',
163164
element: <ManageStripeLinksPage />,
164165
},
166+
{
167+
path: '/roomRequest',
168+
element: <ManageRoomRequestsPage />,
169+
},
165170
// Catch-all route for authenticated users shows 404 page
166171
{
167172
path: '*',

src/ui/components/AppShell/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
IconPizza,
1818
IconTicket,
1919
IconLock,
20+
IconDoor,
2021
} from '@tabler/icons-react';
2122
import { ReactNode } from 'react';
2223
import { useNavigate } from 'react-router-dom';
@@ -65,6 +66,13 @@ export const navItems = [
6566
description: null,
6667
validRoles: [AppRoles.STRIPE_LINK_CREATOR],
6768
},
69+
{
70+
link: '/roomRequest',
71+
name: 'Room Requests',
72+
icon: IconDoor,
73+
description: null,
74+
validRoles: [AppRoles.ROOM_REQUEST_CREATE, AppRoles.ROOM_REQUEST_UPDATE],
75+
},
6876
];
6977

7078
export const extLinks = [
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React, { useState } from 'react';
2+
import { Card, Container, Divider, Title, Text } from '@mantine/core';
3+
import { AuthGuard } from '@ui/components/AuthGuard';
4+
import { AppRoles } from '@common/roles';
5+
import {
6+
GetInvoiceLinksResponse,
7+
PostInvoiceLinkRequest,
8+
PostInvoiceLinkResponse,
9+
} from '@common/types/stripe';
10+
import { useApi } from '@ui/util/api';
11+
12+
export const ManageRoomRequestsPage: React.FC = () => {
13+
const api = useApi('core');
14+
15+
const getLinks = async (semester: string): Promise<GetInvoiceLinksResponse> => {
16+
const response = await api.get(`/api/v1/roomRequests/${semester}`);
17+
return response.data;
18+
};
19+
20+
return (
21+
<AuthGuard
22+
resourceDef={{
23+
service: 'core',
24+
validRoles: [AppRoles.ROOM_REQUEST_CREATE, AppRoles.ROOM_REQUEST_UPDATE],
25+
}}
26+
showSidebar={true}
27+
>
28+
<Container>
29+
<Title>Room Requests</Title>
30+
Coming soon!
31+
</Container>
32+
</AuthGuard>
33+
);
34+
};

0 commit comments

Comments
 (0)