Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add log #19

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions core/apiresp.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ type CodeError struct {
ErrCode int `json:"err_code"`
ErrMsg string `json:"err_msg"`
Err struct {
Code int `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
Code int `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
LogID string `json:"log_id,omitempty"`
} `json:"err"`
}

Expand All @@ -65,10 +66,18 @@ func (ce CodeError) Error() string {

func (ce CodeError) String() string {
sb := strings.Builder{}
sb.WriteString("msg:")
sb.WriteString(ce.ErrMsg)
sb.WriteString(",code:")
sb.WriteString("resp err, code:")
sb.WriteString(strconv.Itoa(ce.ErrCode))
sb.WriteString(", msg:")
sb.WriteString(ce.ErrMsg)
sb.WriteString(", inner code:")
sb.WriteString(strconv.Itoa(ce.Err.Code))
sb.WriteString(", inner msg:")
sb.WriteString(ce.Err.Msg)
if len(ce.Err.LogID) > 0 {
sb.WriteString(", log_id:")
sb.WriteString(ce.Err.LogID)
}
return sb.String()
}

Expand Down
20 changes: 20 additions & 0 deletions core/apiresp_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package core

import "testing"

func TestAPIResp_Error_String(t *testing.T) {
err := CodeError{
ErrCode: 10001,
ErrMsg: "error message",
Err: struct {
Code int `json:"code,omitempty"`
Msg string `json:"msg,omitempty"`
LogID string `json:"log_id,omitempty"`
}{
Code: 10002,
Msg: "inner error message",
LogID: "20210101000001",
},
}
t.Logf(err.String())
}
14 changes: 8 additions & 6 deletions service/field/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,25 @@ type QueryLink struct {
type SimpleField struct {
FieldKey string `json:"field_key"`

FieldTypeKey string `json:"field_type_key"`

Options []*Option `json:"options"`

CompoundFields []*SimpleField `json:"compound_fields"`

FieldAlias string `json:"field_alias"`

FieldTypeKey string `json:"field_type_key"`

FieldName string `json:"field_name"`

IsCustomField bool `json:"is_custom_field"`

Options []*Option `json:"options"`

CompoundFields []*SimpleField `json:"compound_fields"`

IsObsoleted bool `json:"is_obsoleted"`

WorkItemScopes []string `json:"work_item_scopes"`

ValueGenerateMode string `json:"value_generate_mode"`

RelationID string `json:"relation_id"`
}

type TargetState struct {
Expand Down
42 changes: 41 additions & 1 deletion service/workitem/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ type Expand struct {
NeedUserDetail bool `json:"need_user_detail"`

NeedSubTaskParent bool `json:"need_sub_task_parent"`

NeedUnionDeliverable bool `json:"need_union_deliverable"`
}

type FieldConf struct {
Expand Down Expand Up @@ -237,7 +239,7 @@ type Schedule struct {
EstimateEndDate *int64 `json:"estimate_end_date,omitempty"`

Owners []string `json:"owners"`

ActualWorkTime *float64 `json:"actual_work_time,omitempty"`

IsAuto *bool `json:"is_auto,omitempty"`
Expand Down Expand Up @@ -399,6 +401,8 @@ type WBSWorkItem struct {
WorkItemTypeKey string `json:"work_item_type_key"`

Milestone bool `json:"milestone"`

UnionDeliverable UnionDeliverable `json:"union_deliverable"`
}

type WbsViewResponse struct {
Expand Down Expand Up @@ -491,6 +495,8 @@ type WorkItemRelation struct {
WorkItemTypeName string `json:"work_item_type_name"`

RelationDetails []*RelationDetail `json:"relation_details"`

RelationType int64 `json:"relation_type"`
}

type WorkItemStatus struct {
Expand Down Expand Up @@ -572,3 +578,37 @@ type WorkflowNode struct {

Participants []string `json:"participants"`
}

type UnionDeliverable struct {
FieldDeliverables []FieldDeliverableItem `json:"field_deliverables"`

InstanceDeliverables []InstanceDeliverableItem `json:"instance_deliverables"`
}

type FieldDeliverableItem struct {
FieldInfo field.FieldValuePair `json:"field_info"`

Placeholder string `json:"placeholder"`

Remark string `json:"remark"`

Status int64 `json:"status"`
}

type InstanceDeliverableItem struct {
Name string `json:"name"`

WorkItemID int64 `json:"work_item_id"`

Deletable bool `json:"deletable"`

MustComplete bool `json:"must_complete"`

StateKey string `json:"state_key"`

StateName string `json:"state_name"`

Owners []string `json:"owners"`

Remark string `json:"remark"`
}