Skip to content

Commit

Permalink
wip(frontend): global admin page
Browse files Browse the repository at this point in the history
  • Loading branch information
ElaBosak233 committed May 30, 2024
1 parent a622a06 commit e6175ac
Show file tree
Hide file tree
Showing 12 changed files with 358 additions and 132 deletions.
87 changes: 54 additions & 33 deletions api/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2622,24 +2622,64 @@ const docTemplate = `{
"type": "object",
"properties": {
"container": {
"$ref": "#/definitions/request.Container"
"type": "object",
"properties": {
"parallel_limit": {
"type": "integer"
},
"request_limit": {
"type": "integer"
}
}
},
"site": {
"$ref": "#/definitions/request.Site"
"type": "object",
"properties": {
"color": {
"type": "string"
},
"description": {
"type": "string"
},
"title": {
"type": "string"
}
}
},
"user": {
"$ref": "#/definitions/request.User"
}
}
},
"request.Container": {
"type": "object",
"properties": {
"parallel_limit": {
"type": "integer"
},
"request_limit": {
"type": "integer"
"type": "object",
"properties": {
"register": {
"type": "object",
"properties": {
"captcha": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
}
}
},
"email": {
"type": "object",
"properties": {
"domains": {
"type": "array",
"items": {
"type": "string"
}
},
"enabled": {
"type": "boolean"
}
}
},
"enabled": {
"type": "boolean"
}
}
}
}
}
}
},
Expand Down Expand Up @@ -2810,17 +2850,6 @@ const docTemplate = `{
}
}
},
"request.Site": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"title": {
"type": "string"
}
}
},
"request.SubmissionCreateRequest": {
"type": "object",
"required": [
Expand Down Expand Up @@ -2927,14 +2956,6 @@ const docTemplate = `{
}
}
},
"request.User": {
"type": "object",
"properties": {
"allow_registration": {
"type": "boolean"
}
}
},
"request.UserCreateRequest": {
"type": "object",
"required": [
Expand Down
87 changes: 54 additions & 33 deletions api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2613,24 +2613,64 @@
"type": "object",
"properties": {
"container": {
"$ref": "#/definitions/request.Container"
"type": "object",
"properties": {
"parallel_limit": {
"type": "integer"
},
"request_limit": {
"type": "integer"
}
}
},
"site": {
"$ref": "#/definitions/request.Site"
"type": "object",
"properties": {
"color": {
"type": "string"
},
"description": {
"type": "string"
},
"title": {
"type": "string"
}
}
},
"user": {
"$ref": "#/definitions/request.User"
}
}
},
"request.Container": {
"type": "object",
"properties": {
"parallel_limit": {
"type": "integer"
},
"request_limit": {
"type": "integer"
"type": "object",
"properties": {
"register": {
"type": "object",
"properties": {
"captcha": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
}
}
},
"email": {
"type": "object",
"properties": {
"domains": {
"type": "array",
"items": {
"type": "string"
}
},
"enabled": {
"type": "boolean"
}
}
},
"enabled": {
"type": "boolean"
}
}
}
}
}
}
},
Expand Down Expand Up @@ -2801,17 +2841,6 @@
}
}
},
"request.Site": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"title": {
"type": "string"
}
}
},
"request.SubmissionCreateRequest": {
"type": "object",
"required": [
Expand Down Expand Up @@ -2918,14 +2947,6 @@
}
}
},
"request.User": {
"type": "object",
"properties": {
"allow_registration": {
"type": "boolean"
}
}
},
"request.UserCreateRequest": {
"type": "object",
"required": [
Expand Down
57 changes: 35 additions & 22 deletions api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -515,18 +515,43 @@ definitions:
request.ConfigUpdateRequest:
properties:
container:
$ref: '#/definitions/request.Container'
properties:
parallel_limit:
type: integer
request_limit:
type: integer
type: object
site:
$ref: '#/definitions/request.Site'
properties:
color:
type: string
description:
type: string
title:
type: string
type: object
user:
$ref: '#/definitions/request.User'
type: object
request.Container:
properties:
parallel_limit:
type: integer
request_limit:
type: integer
properties:
register:
properties:
captcha:
properties:
enabled:
type: boolean
type: object
email:
properties:
domains:
items:
type: string
type: array
enabled:
type: boolean
type: object
enabled:
type: boolean
type: object
type: object
type: object
request.GameCreateRequest:
properties:
Expand Down Expand Up @@ -637,13 +662,6 @@ definitions:
team_id:
type: integer
type: object
request.Site:
properties:
description:
type: string
title:
type: string
type: object
request.SubmissionCreateRequest:
properties:
challenge_id:
Expand Down Expand Up @@ -715,11 +733,6 @@ definitions:
- team_id
- user_id
type: object
request.User:
properties:
allow_registration:
type: boolean
type: object
request.UserCreateRequest:
properties:
email:
Expand Down
12 changes: 11 additions & 1 deletion internal/app/config/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,23 @@ type PlatformCfg struct {
Site struct {
Title string `yaml:"title" json:"title" mapstructure:"title"`
Description string `yaml:"description" json:"description" mapstructure:"description"`
Color string `yaml:"color" json:"color" mapstructure:"color"`
} `yaml:"site" json:"site" mapstructure:"site"`
Container struct {
ParallelLimit int `yaml:"parallel_limit" json:"parallel_limit" mapstructure:"parallel_limit"`
RequestLimit int `yaml:"request_limit" json:"request_limit" mapstructure:"request_limit"`
} `yaml:"container" json:"container" mapstructure:"container"`
User struct {
AllowRegistration bool `yaml:"allow_registration" json:"allow_registration" mapstructure:"allow_registration"`
Register struct {
Enabled bool `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
Captcha struct {
Enabled bool `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
} `yaml:"captcha" json:"captcha" mapstructure:"captcha"`
Email struct {
Domains []string `yaml:"domains" json:"domains" mapstructure:"domains"`
Enabled bool `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
}
} `yaml:"register" json:"register" mapstructure:"register"`
} `yaml:"user" json:"user" mapstructure:"user"`
}

Expand Down
12 changes: 8 additions & 4 deletions internal/extension/files/configs/platform.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
{
"site": {
"title": "Cloudsdale",
"description": "Hack for fun not for profit.",
"title": "Cloudsdale"
"color": "#0C4497"
},
"container": {
"parallel_limit": 1,
"request_limit": 0
},
"user": {
"registration": {
"register": {
"enabled": true,
"captcha": {
"enabled": false
},
"email": {
"domain": [],
"verification": false
"domains": [],
"enabled": false
}
}
}
Expand Down
18 changes: 2 additions & 16 deletions internal/model/request/config_request.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
package request

type Site struct {
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
}

type Container struct {
ParallelLimit int64 `json:"parallel_limit,omitempty"`
RequestLimit int64 `json:"request_limit,omitempty"`
}

type User struct {
AllowRegistration bool `json:"allow_registration,omitempty"`
}
import "github.com/elabosak233/cloudsdale/internal/app/config"

type ConfigUpdateRequest struct {
Site Site `json:"site,omitempty"`
Container Container `json:"container,omitempty"`
User User `json:"user,omitempty"`
config.PlatformCfg
}
Loading

0 comments on commit e6175ac

Please sign in to comment.