-
Notifications
You must be signed in to change notification settings - Fork 2
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
credential api #177
base: dev
Are you sure you want to change the base?
credential api #177
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
-- CreateEnum | ||
ALTER TYPE "AuthType" ADD VALUE 'OAUTH'; | ||
|
||
-- CreateEnum | ||
CREATE TYPE "ValidationStatus" AS ENUM ('PENDING', 'COMPLETED', 'REJECTED', 'ABANDONED'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "ResponseStatus" AS ENUM ('GREEN', 'YELLOW', 'GREY', 'RED'); | ||
|
||
-- AlterEnum | ||
ALTER TYPE "AuthType" ADD VALUE 'OAUTH'; | ||
|
||
-- CreateTable | ||
CREATE TABLE "Credential" ( | ||
"id" TEXT NOT NULL, | ||
"context" JSONB NOT NULL, | ||
"type" JSONB NOT NULL, | ||
"issuer" JSONB NOT NULL, | ||
"issuanceDate" TIMESTAMP(3) NOT NULL, | ||
"expirationDate" TIMESTAMP(3), | ||
"credentialSubject" JSONB NOT NULL, | ||
"proof" JSONB NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "Credential_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "ClaimData" ( | ||
"id" SERIAL NOT NULL, | ||
|
@@ -34,12 +50,15 @@ CREATE TABLE "Image" ( | |
-- CreateTable | ||
CREATE TABLE "CandidUserInfo" ( | ||
"id" SERIAL NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
"claimId" INTEGER, | ||
"firstName" TEXT, | ||
"lastName" TEXT, | ||
"candid_entity_id" TEXT NOT NULL, | ||
"email" TEXT NOT NULL, | ||
"profileURL" TEXT NOT NULL, | ||
"response" "ResponseStatus", | ||
|
||
CONSTRAINT "CandidUserInfo_pkey" PRIMARY KEY ("id") | ||
); | ||
|
@@ -48,13 +67,15 @@ CREATE TABLE "CandidUserInfo" ( | |
CREATE TABLE "ValidationRequest" ( | ||
"id" SERIAL NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
"context" TEXT NOT NULL, | ||
"validatorName" TEXT NOT NULL, | ||
"validatorEmail" TEXT NOT NULL, | ||
"claimId" INTEGER NOT NULL, | ||
"validationClaimId" INTEGER, | ||
"validationStatus" "ValidationStatus" NOT NULL DEFAULT 'PENDING', | ||
"response" "ResponseStatus", | ||
"response" "ResponseStatus" NOT NULL, | ||
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. please do NOT do this allow null |
||
"rating" INTEGER, | ||
"validationDate" TIMESTAMP(3), | ||
"statement" TEXT, | ||
|
||
|
@@ -69,4 +90,3 @@ CREATE UNIQUE INDEX "CandidUserInfo_claimId_key" ON "CandidUserInfo"("claimId"); | |
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "ValidationRequest_validationClaimId_key" ON "ValidationRequest"("validationClaimId"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "postgresql" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export { | ||
claimPost, | ||
createCredential, | ||
claimsGet, | ||
claimGraph, | ||
claimsFeed, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,6 +77,56 @@ export const claimPostSchema = Joi.object({ | |
}), | ||
}); | ||
|
||
export const credentialPostSchema = Joi.object({ | ||
context: Joi.array().required(), | ||
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. hey remove required from ALL of these please except the id 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. Note i think we might want to use the credential endpoint for OTHER types of credentials Are we linking somewhere to the schema? its in the credential
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. we do NOT want to define the schema here in hardcode AND in the real schema itself so lets remove here |
||
id: Joi.string().required(), | ||
type: Joi.array().required(), | ||
issuer: Joi.object({ | ||
id: Joi.string().required(), | ||
type: Joi.array().required(), | ||
}).required(), | ||
issuanceDate: Joi.date().required(), | ||
expirationDate: Joi.date().optional(), | ||
credentialSubject: Joi.object({ | ||
type: Joi.array().required(), | ||
name: Joi.string().required(), | ||
portfolio: Joi.array().items( | ||
Joi.object({ | ||
"@type": Joi.string().required(), | ||
name: Joi.string().required(), | ||
url: Joi.string().uri().required(), | ||
}), | ||
), | ||
evidenceLink: Joi.string().uri().required(), | ||
evidenceDescription: Joi.string().required(), | ||
duration: Joi.string().required(), | ||
achievement: Joi.array() | ||
.items( | ||
Joi.object({ | ||
id: Joi.string().required(), | ||
type: Joi.array().required(), | ||
criteria: Joi.object({ | ||
narrative: Joi.string().required(), | ||
}).required(), | ||
description: Joi.string().required(), | ||
name: Joi.string().required(), | ||
image: Joi.object({ | ||
id: Joi.string().uri().required(), | ||
type: Joi.string().required(), | ||
}).required(), | ||
}), | ||
) | ||
.required(), | ||
}).required(), | ||
proof: Joi.object({ | ||
type: Joi.string().required(), | ||
created: Joi.date().required(), | ||
verificationMethod: Joi.string().required(), | ||
proofPurpose: Joi.string().required(), | ||
proofValue: Joi.string().required(), | ||
}).required(), | ||
}); | ||
|
||
export type ImageDto = { | ||
url: string; | ||
metadata?: { | ||
|
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.
this is interesting are we repurposing the candid workflow for validations? why edit this table?