From 71ef86e0df7e14c14d0b2e9d6b256945c7941c06 Mon Sep 17 00:00:00 2001 From: konrad Date: Sun, 8 Sep 2019 19:22:54 +0000 Subject: [PATCH] Added more infos to a link share auth (#98) --- pkg/routes/api/v1/link_sharing_auth.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkg/routes/api/v1/link_sharing_auth.go b/pkg/routes/api/v1/link_sharing_auth.go index bdc0a2b8e2..bfc02520cb 100644 --- a/pkg/routes/api/v1/link_sharing_auth.go +++ b/pkg/routes/api/v1/link_sharing_auth.go @@ -23,6 +23,13 @@ import ( "net/http" ) +// LinkShareToken represents a link share auth token with extra infos about the actual link share +type LinkShareToken struct { + Token + *models.LinkSharing + ListID int64 `json:"list_id"` +} + // AuthenticateLinkShare gives a jwt auth token for valid share hashes // @Summary Get an auth token for a share // @Description Get a jwt auth token for a shared list from a share hash. @@ -46,5 +53,9 @@ func AuthenticateLinkShare(c echo.Context) error { return handler.HandleHTTPError(err, c) } - return c.JSON(http.StatusOK, Token{Token: t}) + return c.JSON(http.StatusOK, LinkShareToken{ + Token: Token{Token: t}, + LinkSharing: share, + ListID: share.ListID, + }) }