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

Feature/auto generate data #20

Closed
wants to merge 16 commits into from
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@types/inquirer": "^9.0.7",
"@types/parse-git-config": "^3.0.4",
"@types/parse-github-url": "^1.0.3",
"autoprefixer": "^10.4.19",
"axios": "^1.7.2",
"execa": "^9.1.0",
"git-url-parse": "^14.0.0",
Expand All @@ -38,6 +39,7 @@
"next-auth": "^4.24.6",
"nextjs-cors": "^2.2.0",
"octokit": "^4.0.2",
"openai": "^4.47.3",
"parse-git-config": "^3.0.0",
"parse-github-url": "^1.0.2",
"react": "18.2.0",
Expand Down
6 changes: 6 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
143 changes: 79 additions & 64 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -2,96 +2,111 @@
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
provider = "prisma-client-js"
provider = "prisma-client-js"
previewFeatures = ["fullTextSearch"]
}

datasource db {
provider = "postgresql"
// NOTE: When using mysql or sqlserver, uncomment the @db.Text annotations in model Account below
// Further reading:
// https://next-auth.js.org/adapters/prisma#create-the-prisma-schema
// https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#string
url = env("DATABASE_URL")
provider = "postgresql"
// NOTE: When using mysql or sqlserver, uncomment the @db.Text annotations in model Account below
// Further reading:
// https://next-auth.js.org/adapters/prisma#create-the-prisma-schema
// https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#string
url = env("DATABASE_URL")
}

model Post {
id Int @id @default(autoincrement())
name String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

createdBy User @relation(fields: [createdById], references: [id])
createdById String

@@index([name])
id String @id @default(cuid()) // do not generate id
name String
title String
description String //make this about a dog
dateUploaded DateTime?
}

// Necessary for Next auth
model Account {
id String @id @default(cuid())
userId String
type String
provider String
providerAccountId String
refresh_token String? // @db.Text
refresh_token_expires_in Int?
access_token String? // @db.Text
expires_at Int?
token_type String?
scope String?
id_token String? // @db.Text
session_state String?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)

@@unique([provider, providerAccountId])
id String @id @default(cuid())
userId String
type String
provider String
providerAccountId String
refresh_token String? // @db.Text
refresh_token_expires_in Int?
access_token String? // @db.Text
expires_at Int?
token_type String?
scope String?
id_token String? // @db.Text
session_state String?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)

@@unique([provider, providerAccountId])
}

model Session {
id String @id @default(cuid())
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
id String @id @default(cuid())
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}

model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
accounts Account[]
sessions Session[]
posts Post[]
Database Database[]
verified Boolean @default(false)
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
accounts Account[]
sessions Session[]
branches Branch[]
projects Project[]
verified Boolean @default(false)
}

model VerificationToken {
identifier String
token String @unique
expires DateTime
identifier String
token String @unique
expires DateTime

@@unique([identifier, token])
@@unique([identifier, token])
}

model Project {
repo String
instances Database[]
owner String
ownerName String
repository String
repositoryName String
branches Branch[]

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

createdBy User @relation(fields: [createdById], references: [id], onDelete: Cascade, onUpdate: Cascade)
createdById String
rdsInstance RDSInstance @relation(fields: [rdsInstanceId], references: [id])
rdsInstanceId String

@@unique([repository])
@@index([ownerName, repositoryName, owner, repository])
}

@@unique([repo])
model RDSInstance {
id String @id @default(cuid())
baseConnection String?
project Project[]
}

model Database {
id String @id @default(cuid())
branch String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
model Branch {
id String @id @default(cuid())
name String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

createdBy User? @relation(fields: [createdById], references: [id], onDelete: Cascade, onUpdate: Cascade)
createdById String?
project Project @relation(fields: [projectRepo], references: [repo], onDelete: Cascade, onUpdate: Cascade)
projectRepo String
createdBy User @relation(fields: [createdById], references: [id], onDelete: Cascade, onUpdate: Cascade)
createdById String
project Project @relation(fields: [projectRepository], references: [repository], onDelete: Cascade, onUpdate: Cascade)
projectRepository String

@@unique([projectRepo, branch])
@@unique([projectRepository, name])
}
Binary file modified public/favicon.ico
Binary file not shown.
4 changes: 4 additions & 0 deletions public/images/ChevronIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/images/DeleteIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/images/PauseIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/images/PlayIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/images/PlusIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/images/SearchIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions public/images/SoftwareDark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions public/images/SoftwareLight.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions src/app/_components/BranchRow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { CreateButton, DeleteButton } from "./Button";

export default function BranchRow(props: {
creator: string;
name: string;
status: string;
}) {
const actionLabel =
props.status === "No DB" ? "Create Database" : "Connect to Database";

return (
<div className="flex justify-between items-center py-3 pl-12 pr-8 shadow-inner">
<span className="flex flex-row w-3/5">
{props.creator} / {props.name}
</span>
<span className=" w-2/5">
<a href="#" className="hover:underline">
{actionLabel}
</a>
</span>
<div className=" flex flex-row gap-4 w-1/5 justify-end">
{props.status === "No DB" ? (
<CreateButton onClick={() => console.log("Create DB")} />
) : (
<DeleteButton onClick={() => console.log("Delete DB")} />
)}
</div>
</div>
);
}
55 changes: 55 additions & 0 deletions src/app/_components/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import Link from "next/link";

export default function Button(props: {
href: string;
text: string;
yellow?: boolean;
newTab?: boolean;
}) {
return (
<Link
rel={props.newTab ? "noopener noreferrer" : ""}
target={props.newTab ? "_blank" : ""}
href={props.href}
passHref
>
<button
className={`${props.yellow ? "bg-generate-sw hover:bg-generate-sw-dark" : "bg-white hover:bg-project-row"} text-black py-3 px-12`}
>
{props.text}
</button>
</Link>
);
}

export function CreateButton(props: { onClick: () => void }) {
return (
<button onClick={props.onClick}>
<img className=" px-4" src="./images/PlusIcon.svg" />
</button>
);
}

export function DeleteButton(props: { onClick: () => void }) {
return (
<button onClick={props.onClick}>
<img className=" px-4" src="./images/DeleteIcon.svg" />
</button>
);
}

export function PauseButton(props: { onClick: () => void }) {
return (
<button onClick={props.onClick}>
<img className=" px-4" src="./images/PauseIcon.svg" />
</button>
);
}

export function PlayButton(props: { onClick: () => void }) {
return (
<button onClick={props.onClick}>
<img className=" px-4" src="./images/PlayIcon.svg" />
</button>
);
}
18 changes: 18 additions & 0 deletions src/app/_components/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from "react";
import Navbar from "./NavBar";
import DashboardItems from "./DashboardContents";

const Dashboard: React.FC = () => {
return (
<>
<Navbar />
<div className="min-h-screen min-x-screen">
<div className="px-4 sm:px-12 md:px-24 lg:px-48 py-12 min-x-screen min-h-screen bg-gradient-to-b from-generate-dark to-black from-33 text-white">
<DashboardItems />
</div>
</div>
</>
);
};

export default Dashboard;
Loading