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

View File

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

View File

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

View File

@ -11,9 +11,9 @@ type GetSourceBySourceAndNameParamRequest struct {
} }
type NewSourceParamRequest struct { type NewSourceParamRequest struct {
Name string `json:"name"` Name string `query:"name"`
Url string `json:"url"` Url string `query:"url"`
Tags string `json:"tags"` Tags string `query:"tags"`
} }
type RefreshTokenRequest struct { type RefreshTokenRequest struct {

View File

@ -397,7 +397,8 @@ func (s *Handler) newTwitchSource(c echo.Context) error {
// NewRssSource // NewRssSource
// @Summary Creates a new rss source to monitor. // @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 // @Tags Source
// @Router /v1/sources/new/rss [post] // @Router /v1/sources/new/rss [post]
// @Success 200 {object} domain.SourcesResponse "ok" // @Success 200 {object} domain.SourcesResponse "ok"
@ -418,8 +419,8 @@ func (s *Handler) newRssSource(c echo.Context) error {
return c.JSON(http.StatusUnauthorized, p) return c.JSON(http.StatusUnauthorized, p)
} }
param := domain.NewSourceParamRequest{} var param domain.NewSourceParamRequest
err = (&echo.DefaultBinder{}).BindBody(c, &param) err = c.Bind(&param)
if err != nil { if err != nil {
p.BaseResponse.Message = err.Error() p.BaseResponse.Message = err.Error()
return c.JSON(http.StatusBadRequest, p) return c.JSON(http.StatusBadRequest, p)