Skip to content

Commit

Permalink
Merge pull request #19 from bbgrabbag/entries
Browse files Browse the repository at this point in the history
add entries endpoint and qa .env
  • Loading branch information
bbgrabbag authored Feb 17, 2024
2 parents f461a6f + f02edbb commit 5aa8ba2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
7 changes: 5 additions & 2 deletions .env.vault
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ SECRET="dev only"
ADMIN_CLIENT_BASE_URL="http://localhost:5500/index.html"

# development
DOTENV_VAULT_DEVELOPMENT="mk0ti7lLmG/jrGuAPr+qSYjuNneSX64I5tl1Jf1nVQr50vuBKUH9rDwasUlufWBn7f/IWF41+abK62LhoW/8FSqsHNjxa+q3UPSk34CdChVRPMs/szFNU3vbWfj5D/O+52/OM/M+W1kUqqTNacDsyhn1ZaR0td0CPe0JTeH2bZeR1aPhgUk69buhvho5jfRwtTYkb8SkwbW970fciMg9CHerWn29BWvZ6y4VUJnOqPzZ24xLMS/FgKyJHgKLmuWOircATgUS6RymWGX/NMdMV086ZWgIL7JhsnVWyYTI3i/RTMisIN+PTjTEVYLHSHvDdv3Ra1LTUYPXr+KSm4aJqfT76xL4O59QV3GpRWafPzDqLN4Bs9bPRN5NtUlLoux19txE0aBxA2ibZUCBYsJTR7+NDS37OqznC5IpEnYmbiEenMmdZQ69efizCViXsuwwNfoe7MtXUIbiVNPSayySKALihB99eepvI4PMFHGktcmgjZ7CxVabjr0vL865g11EUvLUwX/ljhqlL1NGLojuylTy2KIIK9oNmiyuKty22DPHku2VbXijB67XQtkKFwpnMZiXXMOTNBNkPIeBPkUv2YCLYNQ4ETtLzD/NrCsxDRMmXCaMmY7YURkeC36kraeHmLGILO8HIX1RZkXg5OTsVDpKDFm4"
DOTENV_VAULT_DEVELOPMENT="lv79OBiYa+y3MgpUnyyEwEgvVJvpc+VkuvcmW4/Iv6esxlgDDMyMcYYF1O7RkNt9dS5bO1YQOBz9ZagLt0e5BmD3b/RPdjrsTj9mblR/PE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Gy4bBeRKEFJO3DnBfdVZ4UBbKigkamief37YM/qBcuRc/Y1wAbehm6w3S9F0g8Rn6Q+etp/sXmKveVQ7FyCb9Hft0UHtHCcY9z/Q5nToW6r0+utMzGJblDGZokppuc3MdvESsZaDMW5DzzBpTcweAnc="

# qa
DOTENV_VAULT_QA="t6Kj7ZqVSm5XOUj8X5BcRiyGRdOrAIqfn/3IOiclcxg33mvuxLPixxsNgrNiEViSnAxQib6k6ala8lxhUIAoSIoKCdImH9FY9yfyVffgDuWB079YlLygLBLtcBYoOj04XhsIcbuwa4YCN3LR3RvJT7Kl/4LAgb0B4oAxXT8P7ND7EwrswNTriirLUpEkGg5QnuhUjXvJo0eqWfh6hABZBTknaZgj+SHD6bR8CAchW1PuM5oj7aVUBwyz/qL7t81UJe1Q7pmiXg9twG6CPy+VaFvVvqxQFdvLK2q9BtT+Og5CmQSeQqyzHE1nvRrfcr8bFvJXRvx17Ld0c1LzkYM="

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ tmp
# environment variables
.env
.env.ci
.env.qa
.env.keys

# google auth credentials
Expand Down
1 change: 1 addition & 0 deletions src/models/entry.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const EntrySchema = new mg.Schema(
},
{
timestamps: true,
toJSON: { virtuals: true },
virtuals: {
full_name: {
get() {
Expand Down
7 changes: 6 additions & 1 deletion src/routers/attendance.router.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import ex from "express";
import { checkIn, checkOut } from "../services/attendance.service";
import { checkIn, checkOut, getAllEntries } from "../services/attendance.service";
import { expressjwt } from "express-jwt";
import { SubmissionType, User } from "../types";

const attendanceRouter = ex.Router();

attendanceRouter.get('/entries', async (req, res) => {
const entries = await getAllEntries();
res.status(200).send({ entries });
})

attendanceRouter.use(
expressjwt({ secret: process.env.SECRET as string, algorithms: ["HS256"] }),
);
Expand Down
5 changes: 5 additions & 0 deletions src/services/attendance.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ export const checkOut = async (user: User) => {
throw Error("Latest entry already has checked out: " + latest.end);
await latest.updateOne({ end: new Date() });
};

export const getAllEntries = async () => {
const entries = await EntryModel.find();
return entries
}

0 comments on commit 5aa8ba2

Please sign in to comment.