Skip to content

Commit

Permalink
Merge pull request #79 from 42association/78-minor-fixes
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
ShotaTanemura authored Jun 25, 2024
2 parents c8d3cec + a8a40e3 commit 961cf98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
ports:
- "${API_PORT}:${API_PORT}"
networks:
- activityapi-network
- docker-network
environment:
DSN: ${DSN}
Expand All @@ -29,7 +30,7 @@ services:
ports:
- "3306:${MARIA_PORT}"
networks:
- docker-network
- activityapi-network
environment:
MARIADB_ROOT_PASSWORD: ${MARIA_ROOT_PASS}
MARIADB_DATABASE: ${MARIA_NAME}
Expand All @@ -47,12 +48,14 @@ services:
ports:
- 8080:8080
networks:
- docker-network
- activityapi-network
depends_on:
mariadb:
condition: service_healthy
volumes:
mariadb:
networks:
docker-network:
activityapi-network:
driver: bridge
docker-network:
external: true
6 changes: 3 additions & 3 deletions internal/handlers/shifts.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func AddShiftData(c *gin.Context) {
return
}
if date, err := accessdb.AddShiftToDB(schedule); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
} else {
c.JSON(http.StatusOK, gin.H{"date": date})
Expand Down Expand Up @@ -85,11 +85,11 @@ func ExchangeShiftData(c *gin.Context) {
return
}
if !isDateStringValid(e.Date1) || !isDateStringValid(e.Date2) {
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid date format. It should be in YYYY/MM/DD format"})
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid date format. It should be in YYYY-MM-DD format"})
return
}
if shift1, shift2, err := accessdb.ExchangeShiftsOnDB(e.Login1, e.Login2, e.Date1, e.Date2); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
} else {
c.JSON(http.StatusOK, gin.H{
Expand Down

0 comments on commit 961cf98

Please sign in to comment.