package commands import ( "netina/models" l "netina/repositories/license" "time" ) type CreateLicenseHandler struct { Repository l.LicenseCommandRepository } func(r *CreateLicenseHandler) Handle (command models.CreateLicenseCommand) error { license := &models.License{ Plan_id: command.Plan_id, Period: command.Period, Created_at: time.Now(), Modified_by: command.Modified_by, } return r.Repository.CreateLicense(license) } type UpdateLicenseHandler struct { Repository l.LicenseCommandRepository } func (r *UpdateLicenseHandler) Handle (id uint , command models.UpdateLicenseCommand) (*models.License , error) { license := &models.License{ Plan_id: command.Plan_id, Period: command.Period, Modified_by: command.Modified_by, } return r.Repository.UpdateLicense(id , license) } type RemoveLicenseHandler struct { Repository l.LicenseCommandRepository } func ( r *RemoveLicenseHandler) Handle (id uint) error { return r.Repository.RemoveLicense(id) }