generated from kir-dev/next-nest-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added basic authsch login * new project page added --------- Co-authored-by: Bujdosó Gergő <bujgergo@gmail.com>
- Loading branch information
1 parent
a6a790b
commit 6818e96
Showing
11 changed files
with
398 additions
and
12 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
50 changes: 50 additions & 0 deletions
50
apps/backend/prisma/migrations/20241011172547_/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,50 @@ | ||
-- CreateEnum | ||
CREATE TYPE "Role" AS ENUM ('ADMIN', 'USER'); | ||
|
||
-- AlterTable | ||
ALTER TABLE "User" ADD COLUMN "role" "Role" NOT NULL DEFAULT 'USER'; | ||
|
||
-- CreateTable | ||
CREATE TABLE "Projekt" ( | ||
"id" SERIAL NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"description" TEXT NOT NULL, | ||
"userId" INTEGER NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
||
CONSTRAINT "Projekt_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Sprint" ( | ||
"id" SERIAL NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"startDate" TIMESTAMP(3) NOT NULL, | ||
"endDate" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "Sprint_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Tasks" ( | ||
"id" SERIAL NOT NULL, | ||
"description" TEXT NOT NULL, | ||
"sprintId" INTEGER NOT NULL, | ||
"userId" INTEGER NOT NULL, | ||
"projektId" INTEGER NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
||
CONSTRAINT "Tasks_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Projekt" ADD CONSTRAINT "Projekt_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Tasks" ADD CONSTRAINT "Tasks_sprintId_fkey" FOREIGN KEY ("sprintId") REFERENCES "Sprint"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Tasks" ADD CONSTRAINT "Tasks_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Tasks" ADD CONSTRAINT "Tasks_projektId_fkey" FOREIGN KEY ("projektId") REFERENCES "Projekt"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
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 @@ | ||
BACKEND_URL= https://localhost:3001 |
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,9 @@ | ||
import SprintLogin from '../../components/NewProject'; | ||
|
||
export default function Home() { | ||
return ( | ||
<main className='flex items-center justify-center bg-page-bg-color'> | ||
<SprintLogin /> | ||
</main> | ||
); | ||
} |
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,84 @@ | ||
'use client'; | ||
import { FormEvent, useState } from 'react'; | ||
|
||
import api from '../lib/axiosConfig'; | ||
import { Footer } from './Footer'; | ||
import Navbar from './Navbar'; | ||
|
||
export default function NewProject() { | ||
const [formData, setFormData] = useState({ | ||
name: '', | ||
description: '', | ||
}); | ||
|
||
const [errorMessage, setErrorMessage] = useState<string | null>(null); | ||
|
||
const handleChange = (event: { target: { name: any; value: any } }) => { | ||
setFormData({ ...formData, [event.target.name]: event.target.value }); | ||
console.log('asda'); | ||
}; | ||
|
||
const projectFormState = async (event: FormEvent<HTMLFormElement>) => { | ||
event.preventDefault(); | ||
console.log(formData); | ||
if (!formData.name || !formData.description) { | ||
setErrorMessage('Incomplete Row(s)'); | ||
return; | ||
} | ||
|
||
try { | ||
await api('/project', { | ||
method: 'POST', | ||
headers: { 'Content-Type': 'application/json' }, | ||
data: JSON.stringify(formData), | ||
}); | ||
} catch (error) { | ||
console.log((error as any).message); | ||
} | ||
}; | ||
|
||
return ( | ||
<div className='w-3/5 flex flex-col justify-center px-8 py-8 mx-auto md:h-screen lg:py-0'> | ||
<Navbar /> | ||
<div className='p-6 space-y-4 md:space-y-6 sm:p-8 w-full'> | ||
<h1 className='text-xl font-bold leading-tight tracking-tight text-text-color-h1 md:text-4xl dark:text-bg-color2 w-full text-center'> | ||
Új Projekt Létrehozása | ||
</h1> | ||
{errorMessage && <p className='text-red-500'>{errorMessage}</p>} | ||
<form onSubmit={projectFormState}> | ||
<div className='mb-6'> | ||
<label className='block mb-2 text-m font-medium text-text-color dark:text-bg-color2'>Projekt név</label> | ||
<input | ||
onChange={handleChange} | ||
type='text' | ||
id='name' | ||
name='name' | ||
className='bg-bg-color2 border border-gray-300 text-white sm:text-sm rounded-lg block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-bg-color2 dark:focus:ring-blue-500 dark:focus:border-blue-500' | ||
/> | ||
</div> | ||
<div className='mb-10'> | ||
<label className='block mb-2 text-m font-medium text-text-color dark:text-bg-color2'>Leírás</label> | ||
<textarea | ||
onChange={handleChange} | ||
name='description' | ||
id='description' | ||
className='w-full h-60 bg-bg-color2 border border-gray-300 text-white sm:text-sm rounded-lg block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-bg-color2 dark:focus:ring-blue-500 dark:focus:border-blue-500' | ||
/> | ||
</div> | ||
|
||
<div className='justify-center flex'> | ||
<button | ||
type='submit' | ||
className='w-1/2 border font-semibold text-text-color rounded-lg text-sm px-5 py-2.5 text-center border-[#8b97a4] hover:border-text-color hover:bg-[#2c3540] focus:ring-4 ' | ||
> | ||
Létrehozás | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
<a href='https://github.com/kir-dev/sprint-review-app' target='_blank' rel='noreferrer'> | ||
<Footer /> | ||
</a> | ||
</div> | ||
); | ||
} |
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,6 @@ | ||
import axios from 'axios'; | ||
|
||
const api = axios.create({ | ||
baseURL: process.env.BACKEND_URL, | ||
}); | ||
export default api; |
Oops, something went wrong.