Skip to content

Commit

Permalink
Merge branch 'main' into refactor/remove-SQL-injection
Browse files Browse the repository at this point in the history
  • Loading branch information
barabobBOB authored Feb 4, 2024
2 parents 00aac47 + c01baa2 commit 39c82e2
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 4,070 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Deploy app
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
env:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up database
run: docker-compose -f docker-compose-test.yml up -d

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.21.6'

- name: Generate Swagger
run: go install github.com/swaggo/swag/cmd/swag@latest && source ./swagger-gen.sh

- name: Build
run: go build -v ./...

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ go.work
### Credentials ###
.env

### Swagger ###
pkg/docs

### macOS ###
.DS_Store

Expand Down
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ WORKDIR /app
COPY go.mod *go.sum ./
RUN go mod download
COPY . .
# Swagger
RUN go install github.com/swaggo/swag/cmd/swag@latest
RUN ./swagger-gen.sh
# Server
RUN CGO_ENABLED=0 GOOS=linux go build -o ./server ./cmd/server/*.go
# migration script
RUN CGO_ENABLED=0 GOOS=linux go build -o ./migrate ./cmd/migrate/*.go
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
$ cp .env.template .env
```

필요에 따라 swagger-gen.sh 파일에 exec 권한을 부여합니다.

```bash
$ chmod +x ./swagger-gen.sh
```

추가로, 파이어베이스 프로젝트의 서비스 계정 키를 다운로드하여 `firebase-credentials.json` 파일로 루트 디렉토리에 저장합니다.

## How to run
Expand Down
2 changes: 1 addition & 1 deletion internal/postgres/breed_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (s *BreedPostgresStore) FindBreeds(page int, size int, petType *string) (*p
OFFSET $3
`

rows, err := tx.Query(query, petType, size, (page-1)*size)
rows, err := tx.Query(query, petType, size+1, (page-1)*size)
if err != nil {
return nil, pnd.FromPostgresError(err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/postgres/sos_post_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func (s *SosPostPostgresStore) FindSosPosts(page int, size int, sortBy string) (
`, sortColumn, sortOrder)

rows, err := tx.Query(query, size+1, (page-1)*size)

if err != nil {
return nil, pnd.FromPostgresError(err)
}
Expand Down
Loading

0 comments on commit 39c82e2

Please sign in to comment.