-
Notifications
You must be signed in to change notification settings - Fork 0
Training certificate -> main #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
taybeers22
wants to merge
4
commits into
main
Choose a base branch
from
training-certificate
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4ede23b
feat : added training certificate
taybeers22 3789668
Merge branch 'main' of https://github.com/UTDallasEPICS/abide-connect…
taybeers22 50b492d
resolved merge from main into training-certificate
taybeers22 70b8f06
fix: NEVER UPLOAD ENV FILES
Vikachubro21 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,150 @@ | ||
| <script setup lang="ts"> | ||
| import { ref } from 'vue' | ||
|
|
||
| type Volunteer = { | ||
| id: number | ||
| name: string | ||
| verified: boolean | ||
| } | ||
|
|
||
| const volunteers = ref<Volunteer[]>([]) | ||
|
|
||
| const { data } = await useFetch('/api/admin/training') | ||
|
|
||
| volunteers.value = | ||
| data.value?.map((v: any) => ({ | ||
| id: v.id, | ||
| name: v.name || 'Unknown Volunteer', | ||
| verified: v.status === 'APPROVED' | ||
| })) || [] | ||
| const newName = ref('') | ||
| const newEmail = ref('') | ||
|
|
||
| async function addVolunteer() { | ||
|
|
||
| const newVolunteer = await $fetch('/api/admin/training', { | ||
| method: 'POST', | ||
| body: { | ||
| name: newName.value, | ||
| email: newEmail.value | ||
| } | ||
| }) | ||
|
|
||
| volunteers.value.push({ | ||
| id: newVolunteer.id, | ||
| name: newVolunteer.name, | ||
| verified: false | ||
| }) | ||
|
|
||
| newName.value = '' | ||
| newEmail.value = '' | ||
| } | ||
|
|
||
| async function toggle(v: Volunteer) { | ||
|
|
||
| v.verified = !v.verified | ||
|
|
||
| await $fetch('/api/admin/volunteer', { | ||
| method: 'PATCH', | ||
| body: { | ||
| id: v.id, | ||
| verified: v.verified | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| function removePerson(id: number) { | ||
| volunteers.value = volunteers.value.filter(v => v.id !== id) | ||
| } | ||
| </script> | ||
|
|
||
| <template> | ||
| <div class="page"> | ||
| <h1>Volunteer Verification</h1> | ||
|
|
||
| <div class="add-form"> | ||
| <input v-model="newName" placeholder="Volunteer Name" /> | ||
| <input v-model="newEmail" placeholder="Email" /> | ||
| <button @click="addVolunteer">Add Volunteer</button> | ||
| </div> | ||
|
|
||
| <div | ||
| class="card" | ||
| v-for="v in volunteers" | ||
| :key="v.id" | ||
| :class="{ verified: v.verified }" | ||
| > | ||
| <div class="left"> | ||
| <span>{{ v.name }}</span> | ||
| <small v-if="v.verified">Verified</small> | ||
| <small v-else>Pending</small> | ||
| </div> | ||
|
|
||
| <div class="actions"> | ||
| <input | ||
| type="checkbox" | ||
| :checked="v.verified" | ||
| @change="toggle(v)" | ||
| /> | ||
|
|
||
| <button @click="removePerson(v.id)">Delete</button> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </template> | ||
|
|
||
| <style scoped> | ||
| .page { | ||
| max-width: 650px; | ||
| margin: 120px auto 40px; /* pushes content down */ | ||
| color: white; | ||
| } | ||
|
|
||
|
|
||
| .card { | ||
| background: #0f1b2d; | ||
| padding: 14px 18px; | ||
| border-radius: 10px; | ||
| margin-bottom: 12px; | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .card.verified { | ||
| border-left: 6px solid #4ade80; | ||
| } | ||
|
|
||
| .left { | ||
| display: flex; | ||
| flex-direction: column; | ||
| } | ||
|
|
||
| small { | ||
| font-size: 12px; | ||
| opacity: 0.8; | ||
| } | ||
|
|
||
| .actions { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 12px; | ||
| } | ||
|
|
||
| button { | ||
| background: #ef4444; | ||
| border: none; | ||
| color: white; | ||
| padding: 6px 12px; | ||
| border-radius: 6px; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| button:hover { | ||
| opacity: 0.85; | ||
| } | ||
|
|
||
| input { | ||
| transform: scale(1.4); | ||
| } | ||
| </style> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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,8 @@ | ||
| import prisma from "~~/server/utils/prisma"; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On each API, ensure that the user is logged in (you can check using the betterauth client, there should be an example in one of the other apis) |
||
|
|
||
| export default defineEventHandler(async () => { | ||
| return await prisma.trainingCertificate.findMany({ | ||
| where: { status: "PENDING" } | ||
| }); | ||
| }); | ||
|
|
||
This file contains hidden or 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,14 @@ | ||
| import prisma from "~~/server/utils/prisma"; | ||
|
|
||
| export default defineEventHandler(async (event) => { | ||
| const body = await readBody(event); | ||
|
|
||
| return await prisma.trainingCertificate.create({ | ||
| data: { | ||
| name: body.name, | ||
| email: body.email, | ||
| fileUrl: "", | ||
| status: "PENDING" | ||
| } | ||
| }); | ||
| }); |
This file contains hidden or 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,9 @@ | ||
| import prisma from "~~/server/utils/prisma"; | ||
|
|
||
| export default defineEventHandler(async (event) => { | ||
| const body = await readBody(event) | ||
|
|
||
| return await prisma.volunteer.delete({ | ||
| where: { id: body.id } | ||
| }) | ||
| }) |
This file contains hidden or 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,11 @@ | ||
| import prisma from "~~/server/utils/prisma"; | ||
|
|
||
| export default defineEventHandler(async () => { | ||
| return await prisma.volunteer.findMany({ | ||
| select: { | ||
| id: true, | ||
| name: true, | ||
| zoomVerified: true | ||
| } | ||
| }); | ||
| }); |
This file contains hidden or 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,14 @@ | ||
| import prisma from "~~/server/utils/prisma"; | ||
|
|
||
| export default defineEventHandler(async (event) => { | ||
| const body = await readBody(event); | ||
|
|
||
| return await prisma.trainingCertificate.update({ | ||
| where: { | ||
| id: body.id | ||
| }, | ||
| data: { | ||
| status: body.verified ? "APPROVED" : "PENDING" | ||
| } | ||
| }); | ||
| }); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be linked to the current volunteer table? Like each volunteer has a list of training certificates, and each training certificate links to a volunteer?