-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM golang:1.21.1 | ||
|
||
|
||
RUN mkdir /app | ||
|
||
ADD . /app | ||
|
||
WORKDIR /app | ||
|
||
RUN go build -o main ./src/main.go | ||
|
||
EXPOSE 8080 | ||
CMD [ "/app/main" ] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version: '3.8' | ||
|
||
services: | ||
db: | ||
image: postgres | ||
restart: always | ||
environment: | ||
POSTGRES_PASSWORD: pwd | ||
POSTGRES_USER: user | ||
POSTGRES_DB: CaitsDB | ||
ports: | ||
- "5432:5432" | ||
myapi: | ||
build: . | ||
ports: | ||
- "8080:8080" | ||
environment: | ||
- PORT=8080 | ||
- DATABASE_URL=postgres://user:pwd@db:5432/CaitsDB | ||
depends_on: | ||
- db |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,8 @@ | ||
CREATE TABLE IF NOT EXISTS students ( | ||
nuid integer PRIMARY KEY, | ||
name varchar NOT NULL | ||
); | ||
DROP TABLE IF EXISTS examplegifts; | ||
|
||
CREATE TABLE IF NOT EXISTS books ( | ||
book_id integer PRIMARY KEY, | ||
title varchar NOT NULL, | ||
author varchar NOT NULL | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS checked_out_books ( | ||
checkout_id serial PRIMARY KEY, | ||
book_id integer NOT NULL REFERENCES books (book_id), | ||
nuid integer NOT NULL REFERENCES students (nuid), | ||
expected_return_date timestamp with time zone NOT NULL | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS holds ( | ||
hold_id serial PRIMARY KEY, | ||
book_id integer NOT NULL REFERENCES books (book_id), | ||
nuid integer NOT NULL REFERENCES students (nuid), | ||
hold_creation_date timestamp with time zone NOT NULL | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS liked_books ( | ||
like_id serial PRIMARY KEY, | ||
book_id integer NOT NULL REFERENCES books (book_id), | ||
nuid integer NOT NULL REFERENCES students (nuid) | ||
); | ||
CREATE TABLE examplegifts ( | ||
gift_id integer PRIMARY KEY, | ||
name varchar NOT NULL, | ||
price integer NOT NULL | ||
); |