initial push
This commit is contained in:
Generated
+1067
-1680
File diff suppressed because it is too large
Load Diff
+14
-12
@@ -13,22 +13,24 @@
|
||||
"type": "module",
|
||||
"description": "",
|
||||
"dependencies": {
|
||||
"@prisma/client": "^6.17.1",
|
||||
"@types/bcrypt": "^5.0.2",
|
||||
"@prisma/adapter-pg": "^7.8.0",
|
||||
"@prisma/client": "^7.8.0",
|
||||
"@types/bcrypt": "^6.0.0",
|
||||
"@types/cors": "^2.8.19",
|
||||
"bcrypt": "^6.0.0",
|
||||
"bcryptjs": "^3.0.2",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^5.1.0",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"nodemailer": "^7.0.9",
|
||||
"pg": "^8.16.3"
|
||||
"bcryptjs": "^3.0.3",
|
||||
"cors": "^2.8.6",
|
||||
"dotenv": "^17.4.2",
|
||||
"express": "^5.2.1",
|
||||
"jsonwebtoken": "^9.0.3",
|
||||
"nodemailer": "^8.0.7",
|
||||
"pg": "^8.20.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^5.0.3",
|
||||
"@types/express": "^5.0.6",
|
||||
"@types/jsonwebtoken": "^9.0.10",
|
||||
"@types/nodemailer": "^6.4.17",
|
||||
"prisma": "^6.17.1",
|
||||
"tsx": "^4.20.3"
|
||||
"@types/nodemailer": "^8.0.0",
|
||||
"prisma": "^7.8.0",
|
||||
"tsx": "^4.22.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import "dotenv/config";
|
||||
import { defineConfig, env } from "prisma/config";
|
||||
|
||||
export default defineConfig({
|
||||
schema: "prisma/schema.prisma",
|
||||
datasource: {
|
||||
url: env("DATABASE_URL"),
|
||||
},
|
||||
});
|
||||
@@ -18,7 +18,6 @@ model LoginActivity {
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
|
||||
+10
-4
@@ -6,6 +6,8 @@ import {
|
||||
PriorityStatus,
|
||||
SecurityType,
|
||||
} from "@prisma/client";
|
||||
import { PrismaPg } from "@prisma/adapter-pg";
|
||||
import pg from "pg";
|
||||
import bcrypt from "bcryptjs";
|
||||
|
||||
import {
|
||||
@@ -46,7 +48,11 @@ const uniqueTask = (idx: number) => {
|
||||
return `${sentenceFrom(idx)}\n\nContext: ${hint} [T${idx + 1}]`;
|
||||
};
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
const pool = new pg.Pool({
|
||||
connectionString: process.env.DATABASE_URL,
|
||||
});
|
||||
const adapter = new PrismaPg(pool, { schema: "Athena" });
|
||||
const prisma = new PrismaClient({ adapter });
|
||||
|
||||
const getRandom = <T>(arr: T[]): T =>
|
||||
arr[Math.floor(Math.random() * arr.length)];
|
||||
@@ -199,19 +205,19 @@ async function main() {
|
||||
let todoIndex = 0;
|
||||
|
||||
const createTeamTodo = async (
|
||||
team: Array<Awaited<ReturnType<typeof prisma.user.create>>>
|
||||
team: Array<Awaited<ReturnType<typeof prisma.user.create>>>,
|
||||
) => {
|
||||
const createdByUser = getRandom(team);
|
||||
// 1-3 assignees from the same team (ensure createdBy is included)
|
||||
const baseAssignees = pickSubset(
|
||||
team,
|
||||
1 + Math.floor(Math.random() * Math.min(3, team.length))
|
||||
1 + Math.floor(Math.random() * Math.min(3, team.length)),
|
||||
);
|
||||
const ensureCreatedBy = baseAssignees.some((u) => u.id === createdByUser.id)
|
||||
? baseAssignees
|
||||
: [...baseAssignees, createdByUser];
|
||||
const uniqueAssignees = Array.from(
|
||||
new Map(ensureCreatedBy.map((u) => [u.id, u])).values()
|
||||
new Map(ensureCreatedBy.map((u) => [u.id, u])).values(),
|
||||
);
|
||||
|
||||
const dueDate = new Date();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import prisma from "../prismaClient";
|
||||
import { randomBytes, createHash } from "crypto";
|
||||
|
||||
const APP_BASE_URL = process.env.APP_BASE_URL || "http://localhost:8081";
|
||||
const APP_BASE_URL = process.env.APP_BASE_URL || "http://localhost:5000";
|
||||
const RESET_TOKEN_TTL = Number(process.env.RESET_TOKEN_TTL || 3600);
|
||||
|
||||
export const generateRawToken = (bytes = 32) => {
|
||||
@@ -30,7 +30,7 @@ export const createPasswordResetToken = async (userId: string) => {
|
||||
|
||||
const link = `${APP_BASE_URL.replace(
|
||||
/\/$/,
|
||||
""
|
||||
"",
|
||||
)}/reset-password?token=${rawToken}`;
|
||||
return { rawToken, link, expiresAt };
|
||||
};
|
||||
|
||||
+6
-1
@@ -1,5 +1,10 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import { PrismaPg } from "@prisma/adapter-pg";
|
||||
import pg from "pg";
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL });
|
||||
const adapter = new PrismaPg(pool, { schema: "Athena" });
|
||||
|
||||
const prisma = new PrismaClient({ adapter });
|
||||
|
||||
export default prisma;
|
||||
|
||||
Reference in New Issue
Block a user