(req dto.CommandOperate)
| 130 | } |
| 131 | |
| 132 | func (u *CommandService) Create(req dto.CommandOperate) error { |
| 133 | command, _ := commandRepo.Get(repo.WithByName(req.Name), repo.WithByType(req.Type)) |
| 134 | if command.ID != 0 { |
| 135 | return buserr.New("ErrRecordExist") |
| 136 | } |
| 137 | if err := copier.Copy(&command, &req); err != nil { |
| 138 | return buserr.WithDetail("ErrStructTransform", err.Error(), nil) |
| 139 | } |
| 140 | if err := commandRepo.Create(&command); err != nil { |
| 141 | return err |
| 142 | } |
| 143 | return nil |
| 144 | } |
| 145 | |
| 146 | func (u *CommandService) Delete(ids []uint) error { |
| 147 | if len(ids) == 1 { |
nothing calls this directly
no test coverage detected