Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prod #8

Merged
merged 54 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
8ab54c1
feat: cocktail_id of user
xappyyy Dec 23, 2023
300d034
chore: add explanation
xappyyy Dec 23, 2023
3825186
feat: init Post usecase, checkinPOST endpoint , controller
bblueberries Dec 23, 2023
7df5b55
feat: POSTcheckin controller (bugging)
bblueberries Dec 24, 2023
dc4369d
fix: checkin model primary key not match
xappyyy Dec 24, 2023
c920b3a
fix: call new session every request
xappyyy Dec 24, 2023
73820e5
fix: checkin model primary key not match
xappyyy Dec 24, 2023
55b22d5
feat: pull merge dev into feature/post-checkin-api
bblueberries Dec 24, 2023
4489965
refactor: use ShouldBindJSON instead in controller
bblueberries Dec 24, 2023
f9e481d
refactor: using DTO instead of directly domain in PostCheckin controller
bblueberries Dec 24, 2023
64a9625
refactor: change usecase Post param to DTO, move DTOto domain/user in…
bblueberries Dec 24, 2023
dd19aea
feat: repository package and user repository interface on usecase layer
xappyyy Dec 25, 2023
c3c3ab5
refactor: change location_id to uint
xappyyy Dec 25, 2023
e28bdec
feat: post checkin api (#2)
xappyyy Dec 25, 2023
da301c7
feat: init PATCH user API(usecase,endpoint,controller)
bblueberries Dec 25, 2023
78e8c91
feat: controller for patchUser,change userDTO model
bblueberries Dec 25, 2023
9052084
feat: use controller for Patch username and Patch complete
bblueberries Dec 25, 2023
7d331fe
fix: user_repo UpdateColumn to retrieve all fields from updated row
bblueberries Dec 25, 2023
7b5a63a
feat: user repository can update multiple columns
xappyyy Dec 25, 2023
1df2aa4
feat: PatchUserComplete usecase patching both cocktail_id and is_user…
bblueberries Dec 26, 2023
f1aabbb
style: format
xappyyy Dec 26, 2023
c4b92c4
refactor: plural name packages and method names more general
xappyyy Dec 26, 2023
b429c70
refactor: return with checkins on all methods
xappyyy Dec 26, 2023
9fe4a86
fix: user can patch complete if already completed
xappyyy Dec 26, 2023
64f5180
style: format
xappyyy Dec 26, 2023
3b0f036
docs: wrong explanation on GetField method
xappyyy Dec 26, 2023
5b4e405
feat: patch user endpoints (#3)
xappyyy Dec 26, 2023
0131315
fix: GetField returned only IsUserCompleted
xappyyy Dec 26, 2023
f3c7723
ci: build using buildx
xappyyy Dec 28, 2023
cf3a1f5
ci: build using buildx #5
xappyyy Dec 28, 2023
3c1ff24
refactor: using local timezone
xappyyy Dec 28, 2023
31e565d
refactor: handle errors correctly
xappyyy Dec 28, 2023
93a850f
refactor: helper functions for gin response
xappyyy Dec 28, 2023
50bb8b1
refactor: move helper functions to utils
xappyyy Dec 28, 2023
77496ed
refactor: more informations on response
xappyyy Dec 29, 2023
e71ab8d
Merge branch 'dev' of https://github.com/esc-chula/gearfest-backend i…
mpsean Dec 30, 2023
ca68d46
test: add unit tests
xappyyy Dec 31, 2023
4d1ecab
ci: unit test
xappyyy Dec 31, 2023
10c1fa6
feat: post user, fix: update go.mod, go.sum
mpsean Dec 31, 2023
9d812de
feat: post user (update)
mpsean Dec 31, 2023
3b7a7c2
feat: post user (update)
mpsean Dec 31, 2023
800427b
Merge branch 'test/unit-tests' into mp
xappyyy Dec 31, 2023
4cd6580
feat: post user (#6)
xappyyy Dec 31, 2023
6180734
fix: user_id can be empty and cocktail_id can be null
xappyyy Jan 2, 2024
4b230fd
fix: create return null checkins
xappyyy Jan 2, 2024
bb1665a
refactor: rename methods in user controller
xappyyy Jan 2, 2024
63cc507
refactor: handle signin properly
xappyyy Jan 2, 2024
40e3d7f
feat: reset complete
xappyyy Jan 2, 2024
d6267d8
test: add test on CreateUser and ResetComplete
xappyyy Jan 2, 2024
035b7a7
feat: middleware
xappyyy Jan 2, 2024
34327ed
feat: cors
xappyyy Jan 2, 2024
f5725a8
docs: swagger ui
xappyyy Jan 2, 2024
f81fd89
docs: explain about swagger ui
xappyyy Jan 2, 2024
c762a67
test: unit tests (#7)
xappyyy Jan 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/test-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ jobs:

steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up Docker
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Build Docker Image
run: docker build -t gearfest-backend .
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: test
30 changes: 30 additions & 0 deletions .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Pull request/Push: Unit test"

on:
pull_request:
branches:
- dev
- main
push:
branches:
- dev
- main
jobs:
test:
runs-on: "ubuntu-latest"

steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21.5"
- name: Install dependencies
run: go mod download
- name: Vet
run: go vet ./...
- name: Test
run: |
go test -v -coverpkg ./src/... -coverprofile coverage.out -covermode count ./tests/...
go tool cover -func="./coverage.out"
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
.temp

.env
config.yaml
config.yaml

# coverage report
coverage.out
coverage.html
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Backend interface for the GearFestival website.

1. Clone this repo.
2. Copy `config.local.yaml` in `config` and paste it in the same directory with `.local` removed from its name.
3. Run `go mod download` to download all the dependencies.
3. Replace `<client_id>` with your Google OAuth client id in `config.yaml`.
4. Run `go mod download` to download all the dependencies.

## Running

Expand All @@ -21,7 +22,9 @@ Backend interface for the GearFestival website.
> Note: You have to install [Docker](https://docs.docker.com/get-docker/) and [Supabase CLI](https://github.com/supabase/cli) before running this command.

2. Run `go run ./src/` to start server.
3. Server should be running on `localhost:8080` and `localhost:54323/project/default/editor` for database editor.
3. The server should be running on `localhost:8080`, `localhost:8080/swagger/index.html` for Swagger UI, and `localhost:54323/project/default/editor` for database editor.

> Note: If there are no tables on the database, please run `supabase db reset` to apply migrations.

Ensure to run `supabase stop` to close supabase after finishing your code.

Expand Down Expand Up @@ -54,10 +57,12 @@ Ensure to run `supabase stop` to close supabase after finishing your code.
1. Wait for the code to be reviewed and merged
1. Repeat

> Note: Don't forget to always pull the latest changes from the dev branch before creating a new branch.
> Note: Don't forget to always pull the latest changes from the dev branch and apply migrations on supabase before creating a new branch.
>
> ```bash
> git pull origin dev
>
> supabase db reset
> ```

### Conventional Commit Format
Expand Down
5 changes: 3 additions & 2 deletions config/config.local.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
database:
supabase:
host: 127.0.0.1
user: postgres
password: postgres
dbname: postgres
port: "54322"
sslmode: disable
timezone: Asia/Shanghai
schema: public
google:
client_id: <client_id>
Loading