You've already forked golang-saas-starter-kit
mirror of
https://github.com/raseels-repos/golang-saas-starter-kit.git
synced 2025-12-24 00:01:31 +02:00
fixed internal package unittests
This commit is contained in:
@@ -39,7 +39,19 @@ func (a *Account) Find(ctx context.Context, w http.ResponseWriter, r *http.Reque
|
||||
return web.RespondJson(ctx, w, res, http.StatusOK)
|
||||
}
|
||||
|
||||
// Read returns the specified account from the system.
|
||||
// Read godoc
|
||||
// @Summary Read returns the specified account from the system.
|
||||
// @Description get string by ID
|
||||
// @ID get-string-by-int
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int true "Account ID"
|
||||
// @Success 200 {object} account.Account
|
||||
// @Header 200 {string} Token "qwerty"
|
||||
// @Failure 400 {object} web.Error
|
||||
// @Failure 403 {object} web.Error
|
||||
// @Failure 404 {object} web.Error
|
||||
// @Router /accounts/{id} [get]
|
||||
func (a *Account) Read(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error {
|
||||
claims, ok := ctx.Value(auth.Key).(auth.Claims)
|
||||
if !ok {
|
||||
|
||||
@@ -40,7 +40,7 @@ func API(shutdown chan os.Signal, log *log.Logger, masterDB *sqlx.DB, redis *red
|
||||
app.Handle("PATCH", "/v1/users/switch-account/:accountId", u.SwitchAccount, mid.Authenticate(authenticator))
|
||||
|
||||
// This route is not authenticated
|
||||
app.Handle("GET", "/v1/oauth/token", u.Token)
|
||||
app.Handle("POST", "/v1/oauth/token", u.Token)
|
||||
|
||||
// Register account endpoints.
|
||||
a := Account{
|
||||
@@ -65,8 +65,10 @@ func API(shutdown chan os.Signal, log *log.Logger, masterDB *sqlx.DB, redis *red
|
||||
app.Handle("DELETE", "/v1/projects/:id", p.Delete, mid.Authenticate(authenticator), mid.HasRole(auth.RoleAdmin))
|
||||
|
||||
// Register swagger documentation.
|
||||
app.Handle("GET", "/swagger/", saasSwagger.WrapHandler, mid.Authenticate(authenticator))
|
||||
app.Handle("GET", "/swagger/*", saasSwagger.WrapHandler, mid.Authenticate(authenticator))
|
||||
// TODO: Add authentication. Current authenticator requires an Authorization header
|
||||
// which breaks the browser experience.
|
||||
app.Handle("GET", "/swagger/", saasSwagger.WrapHandler)
|
||||
app.Handle("GET", "/swagger/*", saasSwagger.WrapHandler)
|
||||
|
||||
return app
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user