func (c *WorkItemCommentsController) Create(ctx *app.CreateWorkItemCommentsContext) error {
	return application.Transactional(c.db, func(appl application.Application) error {
		_, err := appl.WorkItems().LoadByID(ctx, ctx.WiID)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, goa.ErrNotFound(err.Error()))
		}

		currentUserIdentityID, err := login.ContextIdentity(ctx)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, goa.ErrUnauthorized(err.Error()))
		}

		reqComment := ctx.Payload.Data
		markup := rendering.NilSafeGetMarkup(reqComment.Attributes.Markup)
		newComment := comment.Comment{
			ParentID:  ctx.WiID,
			Body:      reqComment.Attributes.Body,
			Markup:    markup,
			CreatedBy: *currentUserIdentityID,
		}

		err = appl.Comments().Create(ctx, &newComment, *currentUserIdentityID)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, goa.ErrInternal(err.Error()))
		}

		res := &app.CommentSingle{
			Data: ConvertComment(ctx.RequestData, &newComment),
		}
		return ctx.OK(res)
	})
}
// Create runs the create action.
Create runs the create action.
// Create runs the create action .
func (c *WorkItemCommentsController) Create(ctx *app.CreateWorkItemCommentsContext) error {
	return application.Transactional(c.db, func(appl application.Application) error {
		_, err := appl.WorkItems().LoadByID(ctx, ctx.WiID)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, goa.ErrNotFound(err.Error()))
		}
		currentUserIdentityID, err := login.ContextIdentity(ctx)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, goa.ErrUnauthorized(err.Error()))
		}
		reqComment := ctx.Payload.Data
		markup := rendering.NilSafeGetMarkup(reqComment.Attributes.Markup)
		newComment := comment.Comment{
			ParentID:  ctx.WiID,
			Body:      reqComment.Attributes.Body,
			Markup:    markup,
			CreatedBy: *currentUserIdentityID,
		}
		err = appl.Comments().Create(ctx, &newComment, *currentUserIdentityID)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, goa.ErrInternal(err.Error()))
		}
		res := &app.CommentSingle{
			Data: ConvertComment(ctx.RequestData, &newComment),
		}
		return ctx.OK(res)
	})
}
func ( c * WorkItemCommentsController ) Create ( ctx * app . CreateWorkItemCommentsContext ) error { return application . Transactional ( c . db , func ( appl application . Application ) error { _ , err := appl . WorkItems ( ) . LoadByID ( ctx , ctx . WiID ) if err != nil { return jsonapi . JSONErrorResponse ( ctx , goa . ErrNotFound ( err . Error ( ) ) ) } currentUserIdentityID , err := login . ContextIdentity ( ctx ) if err != nil { return jsonapi . JSONErrorResponse ( ctx , goa . ErrUnauthorized ( err . Error ( ) ) ) } reqComment := ctx . Payload . Data markup := rendering . NilSafeGetMarkup ( reqComment . Attributes . Markup ) newComment := comment . Comment { ParentID : ctx . WiID , Body : reqComment . Attributes . Body , Markup : markup , CreatedBy : * currentUserIdentityID , } err = appl . Comments ( ) . Create ( ctx , & newComment , * currentUserIdentityID ) if err != nil { return jsonapi . JSONErrorResponse ( ctx , goa . ErrInternal ( err . Error ( ) ) ) } res := & app . CommentSingle { Data : ConvertComment ( ctx . RequestData , & newComment ) , } return ctx . OK ( res ) } ) }
Create runs the create action.
Create runs the create action .