-
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.
- Loading branch information
Berat Genç
authored and
Berat Genç
committed
Jan 14, 2024
1 parent
f2c7512
commit 32adb16
Showing
16 changed files
with
404 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DATABASE_URL="mysql://root:ysxgdil0@35.195.248.72:3306/manager" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,23 @@ | ||
-- CreateTable | ||
CREATE TABLE `User` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`email` VARCHAR(191) NOT NULL, | ||
`name` VARCHAR(191) NULL, | ||
|
||
UNIQUE INDEX `User_email_key`(`email`), | ||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `Post` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`title` VARCHAR(191) NOT NULL, | ||
`content` VARCHAR(191) NULL, | ||
`published` BOOLEAN NOT NULL DEFAULT false, | ||
`authorId` INTEGER NOT NULL, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE `Post` ADD CONSTRAINT `Post_authorId_fkey` FOREIGN KEY (`authorId`) REFERENCES `User`(`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,84 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the `Post` table. If the table is not empty, all the data it contains will be lost. | ||
- You are about to drop the `User` table. If the table is not empty, all the data it contains will be lost. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE `Post` DROP FOREIGN KEY `Post_authorId_fkey`; | ||
|
||
-- DropTable | ||
DROP TABLE `Post`; | ||
|
||
-- DropTable | ||
DROP TABLE `User`; | ||
|
||
-- CreateTable | ||
CREATE TABLE `Employee` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`username` VARCHAR(191) NOT NULL, | ||
`email` VARCHAR(191) NOT NULL, | ||
|
||
UNIQUE INDEX `Employee_email_key`(`email`), | ||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `Team` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`name` VARCHAR(191) NOT NULL, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `EmployeeOnTeams` ( | ||
`teamId` INTEGER NOT NULL, | ||
`employeeId` INTEGER NOT NULL, | ||
|
||
PRIMARY KEY (`teamId`, `employeeId`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `Project` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`name` VARCHAR(191) NOT NULL, | ||
`description` VARCHAR(191) NULL, | ||
`teamId` INTEGER NOT NULL, | ||
`employeeId` INTEGER NOT NULL, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `Task` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`title` VARCHAR(191) NOT NULL, | ||
`description` VARCHAR(191) NULL, | ||
`completed` BOOLEAN NOT NULL DEFAULT false, | ||
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), | ||
`updatedAt` DATETIME(3) NOT NULL, | ||
`userId` INTEGER NOT NULL, | ||
`projectId` INTEGER NULL, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE `EmployeeOnTeams` ADD CONSTRAINT `EmployeeOnTeams_teamId_fkey` FOREIGN KEY (`teamId`) REFERENCES `Team`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE `EmployeeOnTeams` ADD CONSTRAINT `EmployeeOnTeams_employeeId_fkey` FOREIGN KEY (`employeeId`) REFERENCES `Employee`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE `Project` ADD CONSTRAINT `Project_teamId_fkey` FOREIGN KEY (`teamId`) REFERENCES `Team`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE `Project` ADD CONSTRAINT `Project_employeeId_fkey` FOREIGN KEY (`employeeId`) REFERENCES `Employee`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE `Task` ADD CONSTRAINT `Task_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `Employee`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE `Task` ADD CONSTRAINT `Task_projectId_fkey` FOREIGN KEY (`projectId`) REFERENCES `Project`(`id`) ON DELETE SET NULL 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,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "mysql" |
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,62 @@ | ||
|
||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
datasource db { | ||
provider = "mysql" | ||
url = env("DATABASE_URL") | ||
} | ||
|
||
|
||
model Employee { | ||
id Int @id @default(autoincrement()) | ||
username String | ||
email String @unique | ||
teams EmployeeOnTeams[] | ||
tasks Task[] | ||
projects Project[] | ||
} | ||
|
||
model Team { | ||
id Int @id @default(autoincrement()) | ||
name String | ||
members EmployeeOnTeams[] | ||
projects Project[] | ||
} | ||
|
||
model EmployeeOnTeams { | ||
teamId Int | ||
employeeId Int | ||
team Team @relation(fields: [teamId], references: [id]) | ||
employee Employee @relation(fields: [employeeId], references: [id]) | ||
@@id([teamId, employeeId]) | ||
} | ||
|
||
model Project { | ||
id Int @id @default(autoincrement()) | ||
name String | ||
description String? | ||
tasks Task[] | ||
teamId Int | ||
employeeId Int | ||
team Team @relation(fields: [teamId], references: [id]) | ||
employee Employee @relation(fields: [employeeId], references: [id]) | ||
} | ||
|
||
model Task { | ||
id Int @id @default(autoincrement()) | ||
title String | ||
description String? | ||
completed Boolean @default(false) | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @updatedAt | ||
userId Int | ||
employee Employee @relation(fields: [userId], references: [id]) | ||
projectId Int? | ||
project Project? @relation(fields: [projectId], references: [id]) | ||
} | ||
|
||
|
||
|
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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
|
||
|
||
@Injectable() | ||
export class AppService { | ||
getHello(): string { | ||
return 'This text should be changed on push!'; | ||
return 'Code must be resfsf'; | ||
|
||
} | ||
} |
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 { Global, Module } from '@nestjs/common'; | ||
import { DatabaseService } from './database.service'; | ||
|
||
@Global() | ||
@Module({ | ||
providers: [DatabaseService], | ||
exports:[DatabaseService] | ||
}) | ||
export class DatabaseModule {} |
Oops, something went wrong.