feat(training): add fields published and retired
This commit is contained in:
parent
79b7567627
commit
df41b45905
9 changed files with 131 additions and 50 deletions
|
|
@ -85,11 +85,18 @@ func (h *APIHandlers) CreateTraining(ctx context.Context, req CreateTrainingRequ
|
|||
slug = *req.Body.Slug
|
||||
}
|
||||
|
||||
published := false
|
||||
if req.Body.Published != nil {
|
||||
published = *req.Body.Published
|
||||
}
|
||||
|
||||
t := training.Training{
|
||||
Name: req.Body.Name,
|
||||
Slug: slug,
|
||||
Days: req.Body.Days,
|
||||
Description: req.Body.Description,
|
||||
Published: published,
|
||||
Retired: false,
|
||||
Pricing: pricing,
|
||||
}
|
||||
|
||||
|
|
@ -118,6 +125,8 @@ func (h *APIHandlers) CreateTraining(ctx context.Context, req CreateTrainingRequ
|
|||
Slug: t.Slug,
|
||||
Days: t.Days,
|
||||
Description: t.Description,
|
||||
Published: t.Published,
|
||||
Retired: t.Retired,
|
||||
Pricing: responsePricing,
|
||||
}, nil
|
||||
}
|
||||
|
|
@ -173,6 +182,8 @@ func (h *APIHandlers) GetTraining(ctx context.Context, req GetTrainingRequestObj
|
|||
Slug: t.Slug,
|
||||
Days: t.Days,
|
||||
Description: t.Description,
|
||||
Published: t.Published,
|
||||
Retired: t.Retired,
|
||||
Pricing: pricing,
|
||||
}, nil
|
||||
}
|
||||
|
|
@ -208,6 +219,8 @@ func (h *APIHandlers) GetTrainingBySlug(ctx context.Context, req GetTrainingBySl
|
|||
Slug: t.Slug,
|
||||
Days: t.Days,
|
||||
Description: t.Description,
|
||||
Published: t.Published,
|
||||
Retired: t.Retired,
|
||||
Pricing: pricing,
|
||||
}, nil
|
||||
}
|
||||
|
|
@ -237,12 +250,19 @@ func (h *APIHandlers) UpdateTraining(ctx context.Context, req UpdateTrainingRequ
|
|||
slug = *req.Body.Slug
|
||||
}
|
||||
|
||||
published := false
|
||||
if req.Body.Published != nil {
|
||||
published = *req.Body.Published
|
||||
}
|
||||
|
||||
t := training.Training{
|
||||
ID: req.TrainingID,
|
||||
Name: req.Body.Name,
|
||||
Slug: slug,
|
||||
Days: req.Body.Days,
|
||||
Description: req.Body.Description,
|
||||
Published: published,
|
||||
Retired: false,
|
||||
Pricing: pricing,
|
||||
}
|
||||
|
||||
|
|
@ -262,6 +282,8 @@ func (h *APIHandlers) UpdateTraining(ctx context.Context, req UpdateTrainingRequ
|
|||
Slug: t.Slug,
|
||||
Days: t.Days,
|
||||
Description: t.Description,
|
||||
Published: t.Published,
|
||||
Retired: t.Retired,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue