-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: generating and storing referral code
- Loading branch information
1 parent
e33de98
commit 6a0d37f
Showing
17 changed files
with
184 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
prisma/migrations/20240824114901_updated_user_model/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
Warnings: | ||
- A unique constraint covering the columns `[referralCode]` on the table `User` will be added. If there are existing duplicate values, this will fail. | ||
- Added the required column `referralCode` to the `User` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "User" ADD COLUMN "referralCode" TEXT NOT NULL, | ||
ALTER COLUMN "message" DROP NOT NULL, | ||
ALTER COLUMN "tncDocVersion" DROP NOT NULL; | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_referralCode_key" ON "User"("referralCode"); |
2 changes: 2 additions & 0 deletions
2
prisma/migrations/20240824115758_updated_user_model/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "User" ADD COLUMN "isTncSigned" BOOLEAN NOT NULL DEFAULT false; |
2 changes: 2 additions & 0 deletions
2
prisma/migrations/20240824121027_updated_user_model/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "User" ALTER COLUMN "isTncSigned" DROP NOT NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { db } from '@/db'; | ||
import { NextResponse } from 'next/server'; | ||
|
||
export async function POST(req: Request) { | ||
const { address, referralCode } = await req.json(); | ||
|
||
const user = await db.user.create({ | ||
data: { | ||
address, | ||
referralCode, | ||
}, | ||
}); | ||
|
||
if (!user) { | ||
return NextResponse.json({ | ||
success: false, | ||
user: null, | ||
}); | ||
} | ||
|
||
return NextResponse.json({ | ||
success: true, | ||
user, | ||
}); | ||
} |
2 changes: 1 addition & 1 deletion
2
src/app/api/tnc/getAllSignedUsers/route.ts → src/app/api/tnc/getAllUsers/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/app/api/tnc/getSignedUser/route.ts → src/app/api/tnc/getUser/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
|
||
interface RefferalPageProps { | ||
params: { | ||
referralCode: string; | ||
}; | ||
} | ||
|
||
const RefferalPage: React.FC<RefferalPageProps> = ({ params }) => { | ||
return <div>{params.referralCode}</div>; | ||
}; | ||
|
||
export default RefferalPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters