fix: remove redundant binding tags and clarify logger compress logic

- Remove binding:"required" from model fields that are manually validated in handlers. - Add parentheses to logger compress default to clarify operator precedence.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
dailz
2026-04-10 09:25:46 +08:00
parent c070dd8abc
commit 347b0e1229
3 changed files with 4 additions and 4 deletions

View File

@@ -47,7 +47,7 @@ func NewLogger(cfg config.LogConfig) (*zap.Logger, error) {
maxSize := applyDefaultInt(cfg.MaxSize, 100)
maxBackups := applyDefaultInt(cfg.MaxBackups, 5)
maxAge := applyDefaultInt(cfg.MaxAge, 30)
compress := cfg.Compress || cfg.MaxSize == 0 && cfg.MaxBackups == 0 && cfg.MaxAge == 0
compress := cfg.Compress || (cfg.MaxSize == 0 && cfg.MaxBackups == 0 && cfg.MaxAge == 0)
lj := &lumberjack.Logger{
Filename: cfg.FilePath,

View File

@@ -2,7 +2,7 @@ package model
// SubmitJobRequest is the API request for submitting a job.
type SubmitJobRequest struct {
Script string `json:"script" binding:"required"`
Script string `json:"script"`
Partition string `json:"partition,omitempty"`
QOS string `json:"qos,omitempty"`
CPUs int32 `json:"cpus,omitempty"`

View File

@@ -22,9 +22,9 @@ func (JobTemplate) TableName() string { return "job_templates" }
// CreateTemplateRequest is the API request for creating a template.
type CreateTemplateRequest struct {
Name string `json:"name" binding:"required"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Script string `json:"script" binding:"required"`
Script string `json:"script"`
Partition string `json:"partition,omitempty"`
QOS string `json:"qos,omitempty"`
CPUs int `json:"cpus,omitempty"`