CreateCourse is the resolver for the createCourse field.
(ctx context.Context, input model.NewCourse)
| 55 | |
| 56 | // CreateCourse is the resolver for the createCourse field. |
| 57 | func (r *mutationResolver) CreateCourse(ctx context.Context, input model.NewCourse) (*model.Course, error) { |
| 58 | course, err := r.CourseDB.Create(input.Name, *input.Description, input.CategoryID) |
| 59 | if err != nil { |
| 60 | return nil, err |
| 61 | } |
| 62 | return &model.Course{ |
| 63 | ID: course.ID, |
| 64 | Name: course.Name, |
| 65 | Description: &course.Description, |
| 66 | }, nil |
| 67 | } |
| 68 | |
| 69 | // Categories is the resolver for the categories field. |
| 70 | func (r *queryResolver) Categories(ctx context.Context) ([]*model.Category, error) { |