Skip to content

Commit

Permalink
omit unused models, update swagger docs
Browse files Browse the repository at this point in the history
  • Loading branch information
krustowski committed Aug 11, 2023
1 parent a544d42 commit 4cbfcb2
Show file tree
Hide file tree
Showing 19 changed files with 294 additions and 274 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

APP_NAME=swis-api
APP_ROOT=/opt/${APP_NAME}
APP_VERSION=5.5.12
APP_VERSION=5.5.13


#
Expand Down
7 changes: 4 additions & 3 deletions auth/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ func checkMethodUsagePermission(pp AuthParams, ctx *gin.Context) bool {
return true
}

func respondWithError(c *gin.Context, code int, message interface{}) {
c.AbortWithStatusJSON(code, gin.H{
"message": message,
func respondWithError(ctx *gin.Context, code int, message interface{}) {
ctx.AbortWithStatusJSON(code, gin.H{
"code": code,
"message": message,
})
return
}
6 changes: 0 additions & 6 deletions backups/models.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
package backups

type Backups struct {
// Array of to be backuped services.
//Backups []Backup `json:"backups"`
Backups map[string]Backup `json:"backups"`
}

type Backup struct {
// Backuped service name -- unique identifier.
ServiceName string `json:"service_name" binding:"required" validation:"required"`
Expand Down
2 changes: 1 addition & 1 deletion business/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var (
// @Description get business entities list
// @Tags business
// @Produce json
// @Success 200 {object} business.Entities
// @Success 200 {object} []business.Business
// @Router /business [get]
func GetBusinessEntities(ctx *gin.Context) {
config.PrintAllRootItems(ctx, Cache, pkgName)
Expand Down
5 changes: 0 additions & 5 deletions business/models.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package business

type Entities struct {
// Array of business records.
Entities map[string]Business `json:"business"`
}

// Business structure
type Business struct {
// Business' unique identifier.
Expand Down
6 changes: 3 additions & 3 deletions depots/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var (
// @Description get depot complete list
// @Tags depots
// @Produce json
// @Success 200 {object} depots.Depot
// @Success 200 {object} []depots.DepotItem
// @Router /depots [get]
func GetDepotItems(ctx *gin.Context) {
config.PrintAllRootItems(ctx, Cache, pkgName)
Expand All @@ -31,7 +31,7 @@ func GetDepotItems(ctx *gin.Context) {
// @Description add new depot item
// @Tags depots
// @Produce json
// @Param request body depots.Depot true "query params"
// @Param request body depots.DepotItem true "query params"
// @Success 200 {object} depots.DepotItem
// @Router /depots/{key} [post]
func PostNewDepotItemByKey(ctx *gin.Context) {
Expand Down Expand Up @@ -78,7 +78,7 @@ func PostDumpRestore(ctx *gin.Context) {
// @Description get depot item list by :owner param
// @Tags depots
// @Produce json
// @Success 200 {object} depots.Depot
// @Success 200 {object} []depots.DepotItem
// @Router /depots/{owner} [get]
func GetDepotItemsByOwner(ctx *gin.Context) {
var owner string = ctx.Param("owner")
Expand Down
12 changes: 0 additions & 12 deletions depots/models.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
package depots

type Depots struct {
Depots map[string]Depot `json:"depots"`
}

type Depot struct {
// Depot owner's name, unique ID.
//Owner string `json:"owner_name"`

// Generic array of depot Items.
DepotItems []DepotItem `json:"depot_items"`
}

type DepotItem struct {
// Numeric unique ID of such Item.
ID int `json:"id"`
Expand Down
Loading

0 comments on commit 4cbfcb2

Please sign in to comment.