Skip to content
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

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/node_modules
/prisma
build
*.env*
dev.db
model.json
.vscode
.DS_Store
*.env.test*
yarn.lock

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
-- CreateEnum
CREATE TYPE "AuthType" AS ENUM ('PASSWORD', 'GITHUB');
CREATE TYPE "AuthType" AS ENUM ('PASSWORD', 'OAUTH', 'GITHUB');

-- CreateEnum
CREATE TYPE "EntityType" AS ENUM ('PERSON', 'ORGANIZATION', 'CLAIM', 'IMPACT', 'EVENT', 'DOCUMENT', 'PRODUCT', 'PLACE', 'UNKNOWN', 'OTHER');

-- CreateEnum
CREATE TYPE "ValidationStatus" AS ENUM ('PENDING', 'COMPLETED', 'REJECTED', 'ABANDONED');

-- CreateEnum
CREATE TYPE "IssuerIdType" AS ENUM ('DID', 'ETH', 'PUBKEY', 'URL');

-- CreateEnum
CREATE TYPE "ResponseStatus" AS ENUM ('GREEN', 'YELLOW', 'GREY', 'RED');

-- CreateEnum
CREATE TYPE "HowKnown" AS ENUM ('FIRST_HAND', 'SECOND_HAND', 'WEB_DOCUMENT', 'VERIFIED_LOGIN', 'BLOCKCHAIN', 'SIGNED_DOCUMENT', 'PHYSICAL_DOCUMENT', 'INTEGRATION', 'RESEARCH', 'OPINION', 'OTHER');

Expand Down Expand Up @@ -80,9 +86,94 @@ CREATE TABLE "Claim" (
CONSTRAINT "Claim_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "Credential" (
"id" SERIAL NOT NULL,
"context" JSONB,
"type" JSONB,
"issuer" JSONB,
"issuanceDate" TIMESTAMP(3),
"expirationDate" TIMESTAMP(3),
"credentialSubject" JSONB,
"proof" JSONB,
"sameAs" JSONB,
"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,
"claimId" INTEGER NOT NULL,
"name" TEXT NOT NULL,

CONSTRAINT "ClaimData_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "Image" (
"id" SERIAL NOT NULL,
"claimId" INTEGER NOT NULL,
"url" TEXT NOT NULL,
"digestMultibase" TEXT,
"metadata" JSONB,
"effectiveDate" TIMESTAMP(3) NOT NULL,
"createdDate" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"owner" TEXT NOT NULL,
"signature" TEXT NOT NULL,

CONSTRAINT "Image_pkey" PRIMARY KEY ("id")
);

-- 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")
);

-- CreateTable
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" NOT NULL,
"rating" INTEGER,
"validationDate" TIMESTAMP(3),
"statement" TEXT,

CONSTRAINT "ValidationRequest_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");

-- CreateIndex
CREATE UNIQUE INDEX "ClaimData_claimId_key" ON "ClaimData"("claimId");

-- CreateIndex
CREATE UNIQUE INDEX "CandidUserInfo_claimId_key" ON "CandidUserInfo"("claimId");

-- CreateIndex
CREATE UNIQUE INDEX "ValidationRequest_validationClaimId_key" ON "ValidationRequest"("validationClaimId");

-- AddForeignKey
ALTER TABLE "Edge" ADD CONSTRAINT "Edge_startNodeId_fkey" FOREIGN KEY ("startNodeId") REFERENCES "Node"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

Expand Down
3 changes: 3 additions & 0 deletions prisma/migrations/migration_lock.toml
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"
17 changes: 16 additions & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,21 @@ model Claim {
lastUpdatedAt DateTime @default(now())
}

model Credential {
id Int @id @default(autoincrement())
context Json?
type Json?
issuer Json?
issuanceDate DateTime?
expirationDate DateTime?
credentialSubject Json?
proof Json?
sameAs Json?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}


// this model is to connect between the claim and the data that supports it
// like the name of the claim, the image, the source, etc.
// maybe to add another atts in future like the urls that can be related to the claim, like the website, the social media, etc.
Expand Down Expand Up @@ -221,4 +236,4 @@ enum HowKnown {
RESEARCH
OPINION
OTHER
}
}
Loading