getTapdTypeMappings retrieves story types from _tool_tapd_workitem_types and maps them to typeMapping. It takes TapdTaskData, a Dal interface, and a system string as arguments. It returns a map of type ID to type name and an error, if any.
(data *TapdTaskData, db dal.Dal, system string)
| 180 | // typeMapping. It takes TapdTaskData, a Dal interface, and a system string as arguments. |
| 181 | // It returns a map of type ID to type name and an error, if any. |
| 182 | func getTapdTypeMappings(data *TapdTaskData, db dal.Dal, system string) (map[uint64]string, errors.Error) { |
| 183 | typeIdMapping := make(map[uint64]string) |
| 184 | issueTypes := make([]models.TapdWorkitemType, 0) |
| 185 | // Create clauses for querying the database |
| 186 | clauses := []dal.Clause{ |
| 187 | dal.From(&models.TapdWorkitemType{}), |
| 188 | dal.Where("connection_id = ? and workspace_id = ? and entity_type = ?", |
| 189 | data.Options.ConnectionId, data.Options.WorkspaceId, system), |
| 190 | } |
| 191 | // Query the database for issue types |
| 192 | err := db.All(&issueTypes, clauses...) |
| 193 | if err != nil { |
| 194 | return nil, err |
| 195 | } |
| 196 | // Map the retrieved issue types |
| 197 | for _, issueType := range issueTypes { |
| 198 | typeIdMapping[issueType.Id] = issueType.Name |
| 199 | } |
| 200 | return typeIdMapping, nil |
| 201 | } |
| 202 | |
| 203 | // getStdTypeMappings creates a map of user type to standard type based on the provided TapdTaskData. |
| 204 | // It returns the created map. |