This repository has been archived by the owner on Oct 8, 2022. It is now read-only.
-
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
1 parent
aa29cce
commit ebd7744
Showing
26 changed files
with
496 additions
and
22 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,2 @@ | ||
ADMIN_TOKEN=admin | ||
DATABASE_URL=postgresql://root:[email protected]:5432/skyvillage |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch Package", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "auto", | ||
"program": "/home/bendi/Dokumentumok/skyvillage-api/main.go" | ||
} | ||
] | ||
} |
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,2 +1,8 @@ | ||
migrate: | ||
go run github.com/prisma/prisma-client-go migrate dev --name init | ||
go run github.com/prisma/prisma-client-go migrate dev --name init | ||
|
||
format: | ||
go run github.com/prisma/prisma-client-go format | ||
|
||
studio: | ||
go run github.com/prisma/prisma-client-go studio |
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,18 @@ | ||
package database | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/SkyVillageMc/skyvillage-api/db" | ||
) | ||
|
||
var DB *db.PrismaClient | ||
|
||
func Init() { | ||
DB = db.NewClient() | ||
|
||
if err := DB.Prisma.Connect(); err != nil { | ||
//This shouldn't happen | ||
log.Fatalf("Error connecting to the db\n%s\n", err.Error()) | ||
} | ||
} |
Binary file not shown.
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
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,54 @@ | ||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" TEXT NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"role" INTEGER NOT NULL DEFAULT 0, | ||
"presence_id" INTEGER NOT NULL, | ||
"party_id" TEXT NOT NULL, | ||
|
||
CONSTRAINT "User_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Presence" ( | ||
"user_id" TEXT NOT NULL, | ||
"state" TEXT NOT NULL DEFAULT E'', | ||
"large_image_key" TEXT NOT NULL DEFAULT E'logo_large', | ||
"small_image_key" TEXT NOT NULL DEFAULT E'loading', | ||
"start_time" BIGINT NOT NULL DEFAULT 0, | ||
"end_time" BIGINT NOT NULL DEFAULT 0, | ||
"details" TEXT NOT NULL DEFAULT E'', | ||
"large_image_text" TEXT NOT NULL DEFAULT E'', | ||
"small_image_text" TEXT NOT NULL DEFAULT E'', | ||
"party_id" TEXT NOT NULL, | ||
|
||
CONSTRAINT "Presence_pkey" PRIMARY KEY ("user_id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Party" ( | ||
"id" TEXT NOT NULL, | ||
"min" INTEGER NOT NULL DEFAULT 0, | ||
"max" INTEGER NOT NULL DEFAULT 5, | ||
"join_secret" TEXT NOT NULL DEFAULT E'', | ||
"owner_id" TEXT NOT NULL, | ||
|
||
CONSTRAINT "Party_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Party_owner_id_unique" ON "Party"("owner_id"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "User" ADD CONSTRAINT "User_id_fkey" FOREIGN KEY ("id") REFERENCES "Presence"("user_id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "User" ADD CONSTRAINT "User_party_id_fkey" FOREIGN KEY ("party_id") REFERENCES "Party"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Presence" ADD CONSTRAINT "Presence_party_id_fkey" FOREIGN KEY ("party_id") REFERENCES "Party"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Party" ADD CONSTRAINT "Party_owner_id_fkey" FOREIGN KEY ("owner_id") 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,14 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `owner_id` on the `Party` table. All the data in the column will be lost. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "Party" DROP CONSTRAINT "Party_owner_id_fkey"; | ||
|
||
-- DropIndex | ||
DROP INDEX "Party_owner_id_unique"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "Party" DROP COLUMN "owner_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
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 = "postgresql" |
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,13 @@ | ||
package models | ||
|
||
type Presence struct { | ||
State string `json:"state" binding:"required"` | ||
LargeImageKey string `json:"large_image_key" binding:"required"` | ||
SmallImageKey string `json:"small_image_key" binding:"required"` | ||
StartTime int64 `json:"start_time"` | ||
EndTime int64 `json:"end_time"` | ||
Details string `json:"details" binding:"required"` | ||
LargeImageText string `json:"large_image_text" binding:"required"` | ||
SmallImageText string `json:"small_image_text" binding:"required"` | ||
PartyId string `json:"party_id" binding:"required"` | ||
} |
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
Oops, something went wrong.