-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added upcoming and held meetings
- Loading branch information
Showing
11 changed files
with
384 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { ElysiaApp } from '@/app' | ||
import { db } from '@/utils/db' | ||
import { eq } from 'drizzle-orm' | ||
import { sessions, trainers, users } from '@/db/schema' | ||
import { validateRequest } from '@/utils/validateRequest' | ||
|
||
export default (app: ElysiaApp) => | ||
app.get('/', async ({ set, cookie: { auth_session } }) => { | ||
const userSession = await db.query.sessions.findFirst({ where: eq(sessions.id, auth_session.value) }) | ||
const { user, session } = await validateRequest(auth_session) | ||
|
||
if (user && session && userSession) { | ||
const userData = await db.query.users.findFirst({ where: eq(users.id, userSession.userId) }) | ||
|
||
if (userData?.accessToken) { | ||
const data = await db.select({ | ||
id: trainers.id, | ||
name: trainers.name, | ||
username: trainers.username, | ||
email: trainers.email, | ||
profilePicture: trainers.profilePictureUrl, | ||
}).from(trainers) | ||
set.status = 200 | ||
return data | ||
} | ||
|
||
if (!userData) { | ||
set.status = 401 | ||
return { message: 'unauthorized' } | ||
} | ||
} else { | ||
set.status = 401 | ||
return { message: 'unauthorized' } | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,8 @@ | |
margin: 0 auto; | ||
padding: 64px 40px 0; | ||
max-width: 1360px; | ||
|
||
@media (width <= 1024px) { | ||
padding: 64px 20px 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.