Skip to content

Commit

Permalink
Merge pull request #15 from ystv/ci-swagger-docs
Browse files Browse the repository at this point in the history
CI generated swagger docs
  • Loading branch information
rmil authored Jan 2, 2022
2 parents 13cfb66 + 0487e7d commit 45b2419
Show file tree
Hide file tree
Showing 27 changed files with 189 additions and 10,039 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.env.local
docker-compose.yml
web-api
web-api
/swagger
*.sw[a-z]
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ RUN go mod download
# Copy source
COPY . .

# Generate documentation
RUN go install github.com/swaggo/swag/cmd/swag@latest
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go generate

# Download git
RUN apk update && apk upgrade && \
apk add --no-cache git ca-certificates tzdata && \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ if that doesn't work try `git clone https://github.com/ystv/web-api`
Run `go build -o web-api`, hopefully you've got the binary.

Copy the `.env` file from `configs` and place it in the root directory
`mv configs/.env .`
`cp configs/.env .`

Run `./web-api` and hopefully it should be running.

Expand Down
2 changes: 1 addition & 1 deletion controllers/v1/clapper/crew.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (r *Repos) NewCrew(c echo.Context) error {
//
// @Summary Delete crew
// @Description deletes a crew position by ID.
// @ID delete-signup
// @ID delete-crew
// @Tags clapper-crews
// @Param signupid path int true "Event ID"
// @Param signupid path int true "Signup ID"
Expand Down
3 changes: 1 addition & 2 deletions controllers/v1/creator/playlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/labstack/echo/v4"
"github.com/ystv/web-api/services/creator/types/playlist"
"github.com/ystv/web-api/utils"
"gopkg.in/guregu/null.v4"
)

// ListPlaylist handles listing all playlist metadata's
Expand Down Expand Up @@ -103,7 +102,7 @@ func (r *Repos) UpdatePlaylist(c echo.Context) error {
err = fmt.Errorf("PlaylistUpdate failed to get user ID: %w", err)
return echo.NewHTTPError(http.StatusInternalServerError, err)
}
p.UpdatedBy = null.IntFrom(int64(claims.UserID))
p.UpdatedBy = &claims.UserID
var videoIDs []int
for _, v := range p.Videos {
videoIDs = append(videoIDs, v.ID)
Expand Down
6 changes: 3 additions & 3 deletions controllers/v1/creator/video.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/labstack/echo/v4"
"github.com/ystv/web-api/services/creator/types/video"
"github.com/ystv/web-api/utils"
"gopkg.in/guregu/null.v4"
)

// GetVideo finds a video by ID
Expand Down Expand Up @@ -92,8 +91,9 @@ func (r *Repos) UpdateVideoMeta(c echo.Context) error {
err = fmt.Errorf("failed to get token: %w", err)
return echo.NewHTTPError(http.StatusBadRequest, err)
}
v.UpdatedByID = null.IntFrom(int64(t.UserID))
v.UpdatedAt = null.TimeFrom(time.Now())
v.UpdatedByID = &t.UserID
currentDateTime := time.Now()
v.UpdatedAt = &currentDateTime
err = r.video.UpdateMeta(c.Request().Context(), v)
if err != nil {
err = fmt.Errorf("failed to update meta: %w", err)
Expand Down
4 changes: 3 additions & 1 deletion controllers/v1/encoder/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func NewEncoderController(enc *encoder.Encoder) *EncoderController {
return &EncoderController{enc: enc}
}

// TODO: look into adding the parameter object without
// causing swagger to need to check external dependencies

// UploadRequest handles authenticating an upload request.
//
// Connects with tusd through web-hooks, so tusd POSTs here.
Expand All @@ -60,7 +63,6 @@ func NewEncoderController(enc *encoder.Encoder) *EncoderController {
// @ID new-encoder-upload-request
// @Tags encoder
// @Accept json
// @Param request body Request true "Upload Request"
// @Success 200
// @Router /v1/internal/encoder/upload_request [post]
func (e *EncoderController) UploadRequest(c echo.Context) error {
Expand Down
Loading

0 comments on commit 45b2419

Please sign in to comment.