MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / createProject

Function createProject

cmd/cql-proxy/api/project.go:121–152  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

119}
120
121func createProject(c *gin.Context) {
122 r := struct {
123 NodeCount uint16 `json:"node" form:"node" binding:"gt=0"`
124 }{}
125
126 if err := c.ShouldBind(&r); err != nil {
127 abortWithError(c, http.StatusBadRequest, err)
128 return
129 }
130
131 developer := getDeveloperID(c)
132 p, err := model.GetMainAccount(model.GetDB(c), developer)
133 if err != nil {
134 _ = c.Error(err)
135 abortWithError(c, http.StatusBadRequest, ErrNoMainAccount)
136 return
137 }
138
139 // run task
140 taskID, err := getTaskManager(c).New(model.TaskCreateProject, developer, p.ID, gin.H{
141 "node_count": r.NodeCount,
142 })
143 if err != nil {
144 _ = c.Error(err)
145 abortWithError(c, http.StatusInternalServerError, ErrCreateTaskFailed)
146 return
147 }
148
149 responseWithData(c, http.StatusOK, gin.H{
150 "task_id": taskID,
151 })
152}
153
154// CreateProjectTask handles the project creation process.
155func CreateProjectTask(ctx context.Context, cfg *config.Config, db *gorp.DbMap, t *model.Task) (r gin.H, err error) {

Callers

nothing calls this directly

Calls 8

GetMainAccountFunction · 0.92
GetDBFunction · 0.92
abortWithErrorFunction · 0.85
getDeveloperIDFunction · 0.85
getTaskManagerFunction · 0.85
responseWithDataFunction · 0.85
ErrorMethod · 0.80
NewMethod · 0.65

Tested by

no test coverage detected