From ba914f1fb86878bf7f201c4b5b74e8eeca18e13a Mon Sep 17 00:00:00 2001 From: Ivan Alvarez <68352406+IvanA673@users.noreply.github.com> Date: Wed, 1 Jan 2025 17:59:16 -0800 Subject: [PATCH 1/3] Update README.md --- README.md | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 130bf99..70ef741 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# name of non-profit +# Paso Robles Food Cooperative -{One sentence description of the project} +The Paso Robles Food Co-op is launching a referral program to incentivize community members to spread the word and help the co-op reach its membership goal of 500 owners. ## Table of Contents @@ -13,17 +13,27 @@ ### Purpose -{Short paragraph description of the non-profit mission and the purpose of this project. Who will this project help, why is it necessary. Impact of the project.} +The Paso Robles Food Co-op is a non-profit organization dedicated to building a community-owned grocery store that prioritizes local, fresh, and healthy food. This referral program is essential to achieving their mission by increasing membership. By incentivizing current members to spread the word, the co-op can accelerate the path to opening its doors, providing the community with increased access to high-quality, locally sourced food. This will have a significant positive impact by supporting local farmers and producers, strengthening the local economy, and improving the overall health and well-being of the community. ### Team -The {non-profit name} team consists of {#} Cal Poly students. Over the course of about 9 months, we worked as a team to deploy this web application. The team members are listed below: - -- [First Last](https://www.linkedin.com/) - Project Manager -- [First Last](https://www.linkedin.com/) - Designer -- [First Last](https://www.linkedin.com/) - Tech Lead -- [First Last](https://www.linkedin.com/) - Tech Lead -- [First Last](https://www.linkedin.com/) - Software Developer +The PRFC team consists of 15 Cal Poly students. Over the course of about 9 months, we worked as a team to deploy this web application. The team members are listed below: + +- [Alexios Sideris](https://www.linkedin.com/) - Project Manager +- [Naomi Tan](https://www.linkedin.com/) - Designer +- [Kayle Le](https://www.linkedin.com/) - Designer +- [Anagha Kulkami](https://www.linkedin.com/) - Designer +- [Ivan Alvarez](https://www.linkedin.com/) - Tech Lead +- [Amanda Chan](https://www.linkedin.com/) - Tech Lead +- [Vinayak Kohli](https://www.linkedin.com/) - Software Developer +- [Deep Singh](https://www.linkedin.com/) - Software Developer +- [Karthik Balaji](https://www.linkedin.com/) - Software Developer +- [Min Hset Hlaing](https://www.linkedin.com/) - Software Developer +- [Chenyi Zhao](https://www.linkedin.com/) - Software Developer +- [Sue Sue](https://www.linkedin.com/) - Software Developer +- [Camila Yeremin](https://www.linkedin.com/) - Software Developer +- [Winnie Trinh](https://www.linkedin.com/) - Software Developer +- [Charles Moreno](https://www.linkedin.com/) - Software Developer ## Getting Started And Contributing From b27f1d0611f0e20c16b16ecd31cdbd0b26735e5b Mon Sep 17 00:00:00 2001 From: IvanA673 <22ivana04@gmail.com> Date: Fri, 3 Jan 2025 13:15:30 -0800 Subject: [PATCH 2/3] Installed Prisma and connected Supabase. --- .gitignore | 1 + package-lock.json | 77 +++++++++++++++++++++++++++++++------------- package.json | 1 + prisma/schema.prisma | 15 +++++++++ src/database/db.ts | 22 +++---------- 5 files changed, 76 insertions(+), 40 deletions(-) create mode 100644 prisma/schema.prisma diff --git a/.gitignore b/.gitignore index 8f322f0..45c1abc 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ yarn-error.log* # local env files .env*.local +.env # vercel .vercel diff --git a/package-lock.json b/package-lock.json index 7d47725..ea15c25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "name": "nextjs-app-template", "version": "0.1.0", "dependencies": { + "@prisma/client": "^6.1.0", "mongoose": "^8", "next": "^14", "react": "^18", @@ -166,6 +167,7 @@ "version": "1.1.9", "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.9.tgz", "integrity": "sha512-tVkljjeEaAhCqTzajSdgbQ6gE6f3oneVwa3iXR6csiEwXXOFsiC6Uh9iAjAhXPtqa/XMDHWjjeNH/77m/Yq2dw==", + "license": "MIT", "dependencies": { "sparse-bitfield": "^3.0.3" } @@ -385,6 +387,24 @@ "url": "https://opencollective.com/unts" } }, + "node_modules/@prisma/client": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-6.1.0.tgz", + "integrity": "sha512-AbQYc5+EJKm1Ydfq3KxwcGiy7wIbm4/QbjCKWWoNROtvy7d6a3gmAGkKjK0iUCzh+rHV8xDhD5Cge8ke/kiy5Q==", + "hasInstallScript": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "peerDependencies": { + "prisma": "*" + }, + "peerDependenciesMeta": { + "prisma": { + "optional": true + } + } + }, "node_modules/@rtsao/scc": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz", @@ -454,12 +474,14 @@ "node_modules/@types/webidl-conversions": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz", - "integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==" + "integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==", + "license": "MIT" }, "node_modules/@types/whatwg-url": { "version": "11.0.5", "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.5.tgz", "integrity": "sha512-coYR071JRaHa+xoEvvYqvnIHaVqaYrLPbsufM9BF63HkwI5Lgmy2QR8Q5K/lYDYo5AK82wOvSOS0UsLTpTG7uQ==", + "license": "MIT", "dependencies": { "@types/webidl-conversions": "*" } @@ -985,9 +1007,10 @@ } }, "node_modules/bson": { - "version": "6.8.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-6.8.0.tgz", - "integrity": "sha512-iOJg8pr7wq2tg/zSlCCHMi3hMm5JTOxLTagf3zxhcenHsFp+c6uOs6K7W5UE7A4QIJGtqh/ZovFNMP4mOPJynQ==", + "version": "6.10.1", + "resolved": "https://registry.npmjs.org/bson/-/bson-6.10.1.tgz", + "integrity": "sha512-P92xmHDQjSKPLHqFxefqMxASNq/aWJMEZugpCjf+AF/pgcUpMMQCg7t7+ewko0/u8AapvF3luf/FoehddEK+sA==", + "license": "Apache-2.0", "engines": { "node": ">=16.20.1" } @@ -1192,10 +1215,11 @@ "dev": true }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -3505,7 +3529,8 @@ "node_modules/memory-pager": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", - "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==" + "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", + "license": "MIT" }, "node_modules/merge-stream": { "version": "2.0.0", @@ -3590,12 +3615,13 @@ } }, "node_modules/mongodb": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.9.0.tgz", - "integrity": "sha512-UMopBVx1LmEUbW/QE0Hw18u583PEDVQmUmVzzBRH0o/xtE9DBRA5ZYLOjpLIa03i8FXjzvQECJcqoMvCXftTUA==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.12.0.tgz", + "integrity": "sha512-RM7AHlvYfS7jv7+BXund/kR64DryVI+cHbVAy9P61fnb1RcWZqOW1/Wj2YhqMCx+MuYhqTRGv7AwHBzmsCKBfA==", + "license": "Apache-2.0", "dependencies": { - "@mongodb-js/saslprep": "^1.1.5", - "bson": "^6.7.0", + "@mongodb-js/saslprep": "^1.1.9", + "bson": "^6.10.1", "mongodb-connection-string-url": "^3.0.0" }, "engines": { @@ -3603,7 +3629,7 @@ }, "peerDependencies": { "@aws-sdk/credential-providers": "^3.188.0", - "@mongodb-js/zstd": "^1.1.0", + "@mongodb-js/zstd": "^1.1.0 || ^2.0.0", "gcp-metadata": "^5.2.0", "kerberos": "^2.0.1", "mongodb-client-encryption": ">=6.0.0 <7", @@ -3638,19 +3664,21 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.1.tgz", "integrity": "sha512-XqMGwRX0Lgn05TDB4PyG2h2kKO/FfWJyCzYQbIhXUxz7ETt0I/FqHjUeqj37irJ+Dl1ZtU82uYyj14u2XsZKfg==", + "license": "Apache-2.0", "dependencies": { "@types/whatwg-url": "^11.0.2", "whatwg-url": "^13.0.0" } }, "node_modules/mongoose": { - "version": "8.7.2", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.7.2.tgz", - "integrity": "sha512-Ok4VzMds9p5G3ZSUhmvBm1GdxanbzhS29jpSn02SPj+IXEVFnIdfwAlHHXWkyNscZKlcn8GuMi68FH++jo0flg==", + "version": "8.9.3", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.9.3.tgz", + "integrity": "sha512-G50GNPdMqhoiRAJ/24GYAzg13yxXDD3FOOFeYiFwtHmHpAJem3hxbYIxAhLJGWbYEiUZL0qFMu2LXYkgGAmo+Q==", + "license": "MIT", "dependencies": { - "bson": "^6.7.0", + "bson": "^6.10.1", "kareem": "2.6.3", - "mongodb": "6.9.0", + "mongodb": "~6.12.0", "mpath": "0.9.0", "mquery": "5.0.0", "ms": "2.1.3", @@ -3689,15 +3717,16 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -4579,6 +4608,7 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", + "license": "MIT", "dependencies": { "memory-pager": "^1.0.2" } @@ -4936,6 +4966,7 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz", "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==", + "license": "MIT", "dependencies": { "punycode": "^2.3.0" }, @@ -5116,6 +5147,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "license": "BSD-2-Clause", "engines": { "node": ">=12" } @@ -5124,6 +5156,7 @@ "version": "13.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-13.0.0.tgz", "integrity": "sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==", + "license": "MIT", "dependencies": { "tr46": "^4.1.1", "webidl-conversions": "^7.0.0" diff --git a/package.json b/package.json index 765419b..74b7030 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "prepare": "husky" }, "dependencies": { + "@prisma/client": "^6.1.0", "mongoose": "^8", "next": "^14", "react": "^18", diff --git a/prisma/schema.prisma b/prisma/schema.prisma new file mode 100644 index 0000000..89d52c6 --- /dev/null +++ b/prisma/schema.prisma @@ -0,0 +1,15 @@ +generator client { + provider = "prisma-client-js" +} + +datasource db { + provider = "postgresql" + url = env("DATABASE_URL") +} + +/// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info. +model Test { + id BigInt @id @default(autoincrement()) + created_at DateTime @default(now()) @db.Timestamptz(6) + name String? @db.VarChar +} diff --git a/src/database/db.ts b/src/database/db.ts index c54cfb5..af1e4e0 100644 --- a/src/database/db.ts +++ b/src/database/db.ts @@ -1,20 +1,6 @@ -import mongoose from "mongoose"; +import { PrismaClient } from "@prisma/client"; -const url: string = process.env.MONGO_URI as string; -let connection: typeof mongoose; +// Prisma Client automatically manages the database connection for you. +const prisma = new PrismaClient(); -/** - * Makes a connection to a MongoDB database. If a connection already exists, does nothing - * Call this function before all api routes - * @returns {Promise} - */ -const connectDB = async () => { - if (!connection) { - // uncomment this line once you have the MONGO_URI set up - // connection = await mongoose.connect(url); - connection = "remove me" as any; // remove me - return connection; - } -}; - -export default connectDB; +export default prisma; From 1f13f9bb3b8f6499c86aed6e84d765e6b534d24a Mon Sep 17 00:00:00 2001 From: IvanA673 <22ivana04@gmail.com> Date: Fri, 3 Jan 2025 14:33:54 -0800 Subject: [PATCH 3/3] updated prisma schema. --- prisma/schema.prisma | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 89d52c6..1c4b0d0 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -8,8 +8,43 @@ datasource db { } /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info. -model Test { - id BigInt @id @default(autoincrement()) - created_at DateTime @default(now()) @db.Timestamptz(6) - name String? @db.VarChar +model referralprogram { + id Int @id @unique @default(autoincrement()) + ref_id String? @unique @default(dbgenerated("gen_random_uuid()")) @db.Uuid + total_points Int? @default(0) + tblowner tblowner? +} + +/// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info. +model tblowner { + owneremail String? @db.VarChar + ownerpasswordhash String? @db.VarChar + ownerstatus Int? + ownername String? @db.VarChar + owneraddress1 String? @db.VarChar + owneraddress2 String? @db.VarChar + ownercity String? @db.VarChar + ownerstate String? @db.VarChar + ownerzip String? @db.VarChar + ownercountry String? @db.VarChar + creationdate DateTime? @db.Date + validthrudate DateTime? @db.Date + lastloggedondate DateTime? @db.Date + downloadcount Int? + default_project_id Int? + active Int? @default(0) + ownerid Int + max_guids Int? @default(0) + img_cust_id String? @db.VarChar + ownerphone String? @db.VarChar + acctid String? @db.VarChar + ownertotal Float? @db.Real + owneraltphone String? @db.VarChar + ownersecondname String? @db.VarChar + ownerorgdata String? @db.VarChar + joindate DateTime? @db.Date + ownerbusinessid String? @db.VarChar + id Int @id @unique @default(autoincrement()) + referral Int? @unique + referralprogram referralprogram? @relation(fields: [referral], references: [id], onUpdate: NoAction) }