-
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.
Merge pull request #6 from isd-sgcu/feat/api
Feat/api
- Loading branch information
Showing
35 changed files
with
3,792 additions
and
0 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,12 @@ | ||
FROM mcr.microsoft.com/devcontainers/javascript-node:1-20-bullseye | ||
|
||
# [Optional] Uncomment this section to install additional OS packages. | ||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
# && apt-get -y install --no-install-recommends <your-package-list-here> | ||
|
||
# [Optional] Uncomment if you want to install an additional version of node using nvm | ||
# ARG EXTRA_NODE_VERSION=10 | ||
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}" | ||
|
||
# [Optional] Uncomment if you want to install more global node modules | ||
# RUN su node -c "npm install -g <your-package-list-here>" |
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 @@ | ||
{ | ||
"name": "CU-TU Unity 2024", | ||
"dockerComposeFile": "docker-compose.yml", | ||
"service": "app", | ||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"loiane.ts-extension-pack", | ||
"ms-azuretools.vscode-docker", | ||
"tamasfe.even-better-toml" | ||
] | ||
} | ||
} | ||
} |
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,31 @@ | ||
version: '3.8' | ||
|
||
services: | ||
app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
|
||
volumes: | ||
- ../..:/workspaces:cached | ||
|
||
command: sleep infinity | ||
|
||
db: | ||
image: postgres:latest | ||
restart: unless-stopped | ||
volumes: | ||
- ./postgres-data:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_USER: postgres | ||
POSTGRES_DB: postgres | ||
|
||
redis: | ||
image: redis:latest | ||
restart: unless-stopped | ||
volumes: | ||
- ./redis-data:/data | ||
|
||
volumes: | ||
postgres-data: |
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,4 @@ | ||
.env | ||
.env.sample | ||
.devcontainer | ||
node_modules |
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,7 @@ | ||
BASIC_AUTH="Basic YWRtaW46cGFzc3dvcmQ=" | ||
|
||
DB_HOST=127.0.0.1 | ||
DB_NAME=cutu | ||
DB_USER=postgres | ||
DB_PASSWORD=postgres | ||
DB_PORT=5432 |
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 @@ | ||
# @format | ||
|
||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for more information: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
# https://containers.dev/guide/dependabot | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: 'devcontainers' | ||
directory: '/' | ||
schedule: | ||
interval: weekly |
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 @@ | ||
dist/ | ||
node_modules/ | ||
.devcontainer/postgres-data/ | ||
.devcontainer/redis-data/ | ||
.env* | ||
!.env.sample |
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,4 @@ | ||
.devcontainer/postgres-data | ||
.devcontainer/redis-data | ||
dist/ | ||
node_modules/ |
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 @@ | ||
{ | ||
"arrowParens": "always", | ||
"bracketSameLine": true, | ||
"semi": false, | ||
"endOfLine": "lf", | ||
"quoteProps": "as-needed", | ||
"singleQuote": true, | ||
"insertPragma": false | ||
} |
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 @@ | ||
FROM node:20.12.0-alpine3.19 AS builder | ||
|
||
WORKDIR /build | ||
|
||
COPY package*.json ./ | ||
|
||
RUN npm install | ||
|
||
COPY . ./ | ||
|
||
RUN npm run build | ||
|
||
FROM node:20.12.0-alpine3.19 AS runner | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder /build/dist/ ./dist/ | ||
COPY package*.json ./ | ||
RUN npm install --omit=dev | ||
|
||
EXPOSE 3000 | ||
|
||
CMD [ "npm", "start" ] |
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,25 @@ | ||
CREATE TABLE IF NOT EXISTS games ( | ||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(), | ||
title varchar(255) NOT NULL, | ||
description text NOT NULL DEFAULT '', | ||
image varchar(255) NOT NULL DEFAULT '', | ||
open boolean NOT NULL DEFAULT false, | ||
actions jsonb NOT NULL DEFAULT '[]', | ||
winner jsonb NOT NULL DEFAULT '{}' | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS players ( | ||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(), | ||
sid uuid NOT NULL, | ||
name varchar(255) NOT NULL, | ||
total_score integer NOT NULL DEFAULT 0 | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS game_history ( | ||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(), | ||
game_id uuid NOT NULL, | ||
player_id uuid NOT NULL, | ||
action jsonb NOT NULL, | ||
created_at timestamp NOT NULL DEFAULT now() | ||
); | ||
|
Oops, something went wrong.