Skip to content

Commit

Permalink
add idenfy
Browse files Browse the repository at this point in the history
  • Loading branch information
calebtuttle committed Aug 2, 2023
1 parent 174bae2 commit 64c35a5
Show file tree
Hide file tree
Showing 5 changed files with 532 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import cors from "cors";
import registerVouched from "./routes/register-vouched.js";
import vouchedMisc from "./routes/vouched.js";
import veriff from "./routes/veriff.js";
import idenfy from "./routes/idenfy.js";
import credentials from "./routes/credentials.js";
import proofMetadata from "./routes/proof-metadata.js";
import admin from "./routes/admin.js";
Expand All @@ -23,6 +24,7 @@ app.use("/vouched", vouchedMisc);
app.use("/credentials", credentials);
app.use("/proof-metadata", proofMetadata);
app.use("/veriff", veriff);
app.use("/idenfy", idenfy);
app.use("/admin", admin);

app.get("/", (req, res) => {
Expand Down
30 changes: 28 additions & 2 deletions src/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ async function initializeDailyVerificationCount(DailyVerificationCount) {
});
const vouchedJobCount = resp.data?.total || 0;
// TODO: Get total Veriff verifications
// TODO: Get total iDenfy verifications
const newDailyVerificationCount = new DailyVerificationCount({
date: new Date().toISOString().slice(0, 10),
vouched: {
Expand All @@ -92,6 +93,9 @@ async function initializeDailyVerificationCount(DailyVerificationCount) {
veriff: {
sessionCount: 0,
},
idenfy: {
sessionCount: 0,
},
});
await newDailyVerificationCount.save();
}
Expand Down Expand Up @@ -237,6 +241,12 @@ async function initializeMongoDb() {
},
required: false,
},
idenfy: {
type: {
sessionCount: Number,
},
required: false,
},
});
const DailyVerificationCount = mongoose.model(
"DailyVerificationCount",
Expand All @@ -256,7 +266,14 @@ async function initializeMongoDb() {
const VerificationCollisionMetadataSchema = new Schema({
uuid: String,
timestamp: Date,
sessionId: String,
sessionId: {
type: String,
required: false,
},
scanRef: {
type: String,
required: false,
},
uuidConstituents: {
firstName: {
populated: Boolean,
Expand All @@ -265,7 +282,16 @@ async function initializeMongoDb() {
populated: Boolean,
},
postcode: {
populated: Boolean,
populated: {
type: Boolean,
required: false,
},
},
address: {
populated: {
type: Boolean,
required: false,
},
},
dateOfBirth: {
populated: Boolean,
Expand Down
10 changes: 10 additions & 0 deletions src/routes/idenfy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import express from "express";
import { getCredentials } from "../services/idenfy/credentials.js";
import { createSession } from "../services/idenfy/session.js";

const router = express.Router();

router.get("/credentials", getCredentials);
router.post("/session", createSession);

export default router;
Loading

0 comments on commit 64c35a5

Please sign in to comment.