Compare commits

..

No commits in common. "56199a795a2b7a8c5e37a904aa133829b9026c47" and "b94257f5aad900cc78f810792db5e567a33500a5" have entirely different histories.

5 changed files with 44 additions and 66 deletions

View File

@ -719,13 +719,18 @@ const docTemplate = `{
"summary": "Creates a new rss source to monitor.",
"parameters": [
{
"description": "body",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/domain.NewSourceParamRequest"
}
"type": "string",
"description": "Site Name",
"name": "name",
"in": "query",
"required": true
},
{
"type": "string",
"description": "RSS Url",
"name": "url",
"in": "query",
"required": true
}
],
"responses": {
@ -858,7 +863,7 @@ const docTemplate = `{
"parameters": [
{
"type": "integer",
"description": "id",
"description": "uuid",
"name": "id",
"in": "path",
"required": true
@ -1430,20 +1435,6 @@ const docTemplate = `{
}
}
},
"domain.NewSourceParamRequest": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"tags": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"domain.RefreshTokenRequest": {
"type": "object",
"properties": {

View File

@ -710,13 +710,18 @@
"summary": "Creates a new rss source to monitor.",
"parameters": [
{
"description": "body",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/domain.NewSourceParamRequest"
}
"type": "string",
"description": "Site Name",
"name": "name",
"in": "query",
"required": true
},
{
"type": "string",
"description": "RSS Url",
"name": "url",
"in": "query",
"required": true
}
],
"responses": {
@ -849,7 +854,7 @@
"parameters": [
{
"type": "integer",
"description": "id",
"description": "uuid",
"name": "id",
"in": "path",
"required": true
@ -1421,20 +1426,6 @@
}
}
},
"domain.NewSourceParamRequest": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"tags": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"domain.RefreshTokenRequest": {
"type": "object",
"properties": {

View File

@ -99,15 +99,6 @@ definitions:
type:
type: string
type: object
domain.NewSourceParamRequest:
properties:
name:
type: string
tags:
type: string
url:
type: string
type: object
domain.RefreshTokenRequest:
properties:
refreshToken:
@ -496,7 +487,7 @@ paths:
/v1/sources/{id}:
get:
parameters:
- description: id
- description: uuid
in: path
name: id
required: true
@ -697,12 +688,16 @@ paths:
/v1/sources/new/rss:
post:
parameters:
- description: body
in: body
name: request
- description: Site Name
in: query
name: name
required: true
schema:
$ref: '#/definitions/domain.NewSourceParamRequest'
type: string
- description: RSS Url
in: query
name: url
required: true
type: string
responses:
"200":
description: ok

View File

@ -11,9 +11,9 @@ type GetSourceBySourceAndNameParamRequest struct {
}
type NewSourceParamRequest struct {
Name string `json:"name"`
Url string `json:"url"`
Tags string `json:"tags"`
Name string `query:"name"`
Url string `query:"url"`
Tags string `query:"tags"`
}
type RefreshTokenRequest struct {
@ -24,4 +24,4 @@ type RefreshTokenRequest struct {
type UpdateScopesRequest struct {
Username string `json:"username"`
Scopes []string `json:"scopes" validate:"required"`
}
}

View File

@ -397,7 +397,8 @@ func (s *Handler) newTwitchSource(c echo.Context) error {
// NewRssSource
// @Summary Creates a new rss source to monitor.
// @Param request body domain.NewSourceParamRequest true "body"
// @Param name query string true "Site Name"
// @Param url query string true "RSS Url"
// @Tags Source
// @Router /v1/sources/new/rss [post]
// @Success 200 {object} domain.SourcesResponse "ok"
@ -418,8 +419,8 @@ func (s *Handler) newRssSource(c echo.Context) error {
return c.JSON(http.StatusUnauthorized, p)
}
param := domain.NewSourceParamRequest{}
err = (&echo.DefaultBinder{}).BindBody(c, &param)
var param domain.NewSourceParamRequest
err = c.Bind(&param)
if err != nil {
p.BaseResponse.Message = err.Error()
return c.JSON(http.StatusBadRequest, p)