diff --git a/server/src/index.ts b/server/src/index.ts index 8ec855e..9986e44 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -1,6 +1,6 @@ import { Hono } from 'hono'; import { cors } from 'hono/cors'; -import v1App from './router/v1/v1.router'; +import v1App from './router/v1.router'; const app = new Hono(); diff --git a/server/src/router/v1.router.ts b/server/src/router/v1.router.ts new file mode 100644 index 0000000..2badf3f --- /dev/null +++ b/server/src/router/v1.router.ts @@ -0,0 +1,21 @@ +import { Hono } from 'hono'; + +import users from './v1/users'; +import events from './v1/events'; +import company from './v1/company'; +import equipment from './v1/equipment'; +import project from './v1/projects'; +import majors from './v1/majors'; +import officers from './v1/officers'; + +const v1App = new Hono(); + +v1App.route('/users', users); +v1App.route('/events', events); +v1App.route('/company', company); +v1App.route('/equipment', equipment); +v1App.route('/project', project); +v1App.route('/majors', majors); +v1App.route('/officers', officers); + +export default v1App; diff --git a/server/src/router/v1/company.ts b/server/src/router/v1/company.ts new file mode 100644 index 0000000..07fbb72 --- /dev/null +++ b/server/src/router/v1/company.ts @@ -0,0 +1,20 @@ +import { Hono } from 'hono'; + +const company = new Hono(); + +company.get('/:companyID/events', c => { + const companyID = c.req.param('companyID'); + return c.json({ companyID }); +}); + +company.get('/:companyID/subsribers', c => { + const companyID = c.req.param('companyID'); + return c.json({ companyID }); +}); + +company.get('/:companyID/subscribers/count', c => { + const companyID = c.req.param('companyID'); + return c.json({ companyID }); +}); + +export default company; diff --git a/server/src/router/v1/equipment.ts b/server/src/router/v1/equipment.ts new file mode 100644 index 0000000..31028d4 --- /dev/null +++ b/server/src/router/v1/equipment.ts @@ -0,0 +1,17 @@ +import { Hono } from 'hono'; + +const equipment = new Hono(); + +equipment.get('/', c => c.json({})); + +equipment.get('/:equipmentTypeID/equipment-items', c => { + const equipmentTypeID = c.req.param('equipmentTypeID'); + return c.json({ equipmentTypeID }); +}); + +equipment.get('/equipmentitem/:equipmentItemID/rental-history', c => { + const equipmentItemID = c.req.param('equipmentItemID'); + return c.json({ equipmentItemID }); +}); + +export default equipment; diff --git a/server/src/router/v1/events.ts b/server/src/router/v1/events.ts new file mode 100644 index 0000000..7517f64 --- /dev/null +++ b/server/src/router/v1/events.ts @@ -0,0 +1,27 @@ +import { Hono } from 'hono'; + +const events = new Hono(); + +events.get('/', c => c.json({})); + +events.get('/:eventID/companies', c => { + const eventID = c.req.param('eventID'); + return c.json({ eventID }); +}); + +events.get('/:eventID/subscribers', c => { + const eventID = c.req.param('eventID'); + return c.json({ eventID }); +}); + +events.get('/:eventID/subscribers/count', c => { + const eventID = c.req.param('eventID'); + return c.json({ eventID }); +}); + +events.get('/:eventID/files', c => { + const eventID = c.req.param('eventID'); + return c.json({ eventID }); +}); + +export default events; diff --git a/server/src/router/v1/majors.ts b/server/src/router/v1/majors.ts new file mode 100644 index 0000000..20bdb3e --- /dev/null +++ b/server/src/router/v1/majors.ts @@ -0,0 +1,12 @@ +import { Hono } from 'hono'; + +const majors = new Hono(); + +majors.get('/', c => c.json({})); + +majors.get('/:majorName/users', c => { + const majorName = c.req.param('majorName'); + return c.json({ majorName }); +}); + +export default majors; diff --git a/server/src/router/v1/officers.ts b/server/src/router/v1/officers.ts new file mode 100644 index 0000000..f30c78c --- /dev/null +++ b/server/src/router/v1/officers.ts @@ -0,0 +1,7 @@ +import { Hono } from 'hono'; + +const officers = new Hono(); + +officers.get('/', c => c.json({})); + +export default officers; diff --git a/server/src/router/v1/projects.ts b/server/src/router/v1/projects.ts new file mode 100644 index 0000000..e051933 --- /dev/null +++ b/server/src/router/v1/projects.ts @@ -0,0 +1,25 @@ +import { Hono } from 'hono'; +import { db } from '../../db/db'; +import { projects as projectsSchema } from '../../db/schema'; +import type { Project } from '../../db/schema'; + +const projects = new Hono(); + +projects.get('/', async c => { + const foundProjects: Project[] = await db.select().from(projectsSchema); + return c.json({ + projects: foundProjects, + }); +}); + +projects.get('/:projectID/interested', c => { + const projectID = c.req.param('projectID'); + return c.json({ projectID }); +}); + +projects.get('/:projectID/files', c => { + const projectID = c.req.param('projectID'); + return c.json({ projectID }); +}); + +export default projects; diff --git a/server/src/router/v1/users.ts b/server/src/router/v1/users.ts new file mode 100644 index 0000000..c566efd --- /dev/null +++ b/server/src/router/v1/users.ts @@ -0,0 +1,17 @@ +import { Hono } from 'hono'; +import { db } from '../../db/db'; +import { users } from '../../db/schema'; +import type { User } from '../../db/schema'; + +const usersRouter = new Hono(); + +usersRouter.get('/', async c => { + const foundUsers: User[] = await db.select().from(users); + return c.json({ + users: foundUsers, + }); +}); + +usersRouter.get('/rental-history', c => c.json({})); + +export default usersRouter; diff --git a/server/src/router/v1/v1.router.ts b/server/src/router/v1/v1.router.ts deleted file mode 100644 index 669ea19..0000000 --- a/server/src/router/v1/v1.router.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Hono } from 'hono'; -import { db } from '../../db/db'; -import { users, projects } from '../../db/schema'; -import type { User, Project } from '../../db/schema'; - -const v1App = new Hono(); - -// Users -v1App.get('/users', async c => { - const foundUsers: User[] = await db.select().from(users); - return c.json({ - users: foundUsers, - }); -}); - -// Projects -v1App.get('/projects', async c => { - const foundProjects: Project[] = await db.select().from(projects); - return c.json({ - projects: foundProjects, - }); -}); - -export default v1App;