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

add partner reward #396

Merged
merged 2 commits into from
Dec 6, 2024
Merged
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: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@charmverse/core",
"version": "0.98.3",
"version": "0.98.4-rc-store-moxie.0",
"description": "Core API for Charmverse",
"type": "commonjs",
"types": "./dist/cjs/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- CreateTable
CREATE TABLE "PartnerRewardEvent" (
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"week" TEXT NOT NULL,
"season" TEXT NOT NULL,
"userId" UUID NOT NULL,
"partner" TEXT NOT NULL,
"reward" JSONB NOT NULL
);

-- CreateIndex
CREATE INDEX "PartnerRewardEvent_userId_idx" ON "PartnerRewardEvent"("userId");

-- CreateIndex
CREATE UNIQUE INDEX "PartnerRewardEvent_userId_partner_week_season_key" ON "PartnerRewardEvent"("userId", "partner", "week", "season");

-- AddForeignKey
ALTER TABLE "PartnerRewardEvent" ADD CONSTRAINT "PartnerRewardEvent_userId_fkey" FOREIGN KEY ("userId") REFERENCES "Scout"("id") ON DELETE CASCADE ON UPDATE CASCADE;
16 changes: 15 additions & 1 deletion src/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -2838,6 +2838,7 @@ model Scout {
talentProfile TalentProfile?
mergedFromEvents ScoutMergeEvent[] @relation("mergedFromScout")
mergedToEvents ScoutMergeEvent[] @relation("mergedToScout")
PartnerRewardEvent PartnerRewardEvent[]

@@index([path])
@@index([farcasterId])
Expand Down Expand Up @@ -3115,7 +3116,7 @@ model BuilderNft {
builder Scout @relation(fields: [builderId], references: [id], onDelete: Cascade)
chainId Int
season String
nftType BuilderNftType @default(default)
nftType BuilderNftType @default(default)
currentPrice BigInt
contractAddress String
tokenId Int
Expand Down Expand Up @@ -3342,3 +3343,16 @@ model TalentProfile {

@@index([builderId])
}

model PartnerRewardEvent {
createdAt DateTime @default(now())
week String
season String
userId String @db.Uuid
user Scout @relation(fields: [userId], references: [id], onDelete: Cascade)
partner String
reward Json

@@unique([userId, partner, week, season])
@@index([userId])
}