Skip to content

2 update prisma schema #8

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

Closed
wants to merge 4 commits into from
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel
Expand Down
30 changes: 20 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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

Expand Down
77 changes: 55 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"prepare": "husky"
},
"dependencies": {
"@prisma/client": "^6.1.0",
"mongoose": "^8",
"next": "^14",
"react": "^18",
Expand Down
50 changes: 50 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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 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)
}
22 changes: 4 additions & 18 deletions src/database/db.ts
Original file line number Diff line number Diff line change
@@ -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<typeof mongoose>}
*/
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;
Loading