package commands import ( "netina/models" p "netina/repositories/plan" "time" ) type CreatePlanHandler struct { Repository p.PlanCommandRepository } func (r *CreatePlanHandler) Handle(command models.CreatePlanCommand) error { plan := &models.Plan{ Price: command.Price, Priod: command.Priod, Partnership: command.Partnership, PercentageOfOwner: command.PercentageOfOwner, Created_at: time.Now(), Modified_by: command.Modified_by, } return r.Repository.CreatePlan(plan) } type UpdatePlanHandler struct { Repository p.PlanCommandRepository } func (r *UpdatePlanHandler) Handle (id uint , command models.UpdatePlanCommand)(*models.Plan , error) { plan := &models.Plan{ Price: command.Price, Priod: command.Priod, Partnership: command.Partnership, PercentageOfOwner: command.PercentageOfOwner, Modified_by: command.Modified_by, } return r.Repository.UpdatePlan(id , plan) } type RemovePlanHandler struct { Repository p.PlanCommandRepository } func (r *RemovePlanHandler) Handle (id uint )error { return r.Repository.RemovePlan(id) }