Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
fix ListMembers response
Browse files Browse the repository at this point in the history
  • Loading branch information
luojielin committed Jul 14, 2021
1 parent e68e2d8 commit bbf5d8f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
5 changes: 3 additions & 2 deletions lib/management/organization_management_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import (
"log"
)

func (c *Client) ExportAll() ([]model.Node, error) {
var q []model.Node
func (c *Client) ExportAll() ([]model.OrgNode, error) {
var q []model.OrgNode
b, err := c.SendHttpRequest(c.Host+"/api/v2/orgs/export", constant.HttpMethodGet, "", nil)
if err != nil {
return q, err
}
var response model.ExportAllOrganizationResponse
log.Println(string(b))
jsoniter.Unmarshal(b, &response)
return response.Data, nil
}
Expand Down
8 changes: 4 additions & 4 deletions lib/management/organization_management_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import (
)

const (
userPoolId = "60a6f97f3f50c7a9483e313d"
appSecret = "d254623f808ba850d5d5ea7b07bead60"
userPoolId = "60e043f8cd91b87d712b6365"
appSecret = "158c7679333bc196b524d78d745813e5"
)

func TestClient_ExportAll(t *testing.T) {
client := NewClient(userPoolId, appSecret)
log.Println("==========导出所有组织机构数据==========")
resp, _ := client.ExportAll()
log.Printf("%+v\n", resp)
log.Println("==========获取节点成员==========")
/*log.Println("==========获取节点成员==========")
var req = &model.ListMemberRequest{
NodeId: "60cd9d3a4b96cfff16e7e5f4",
Page: 1,
Expand All @@ -28,7 +28,7 @@ func TestClient_ExportAll(t *testing.T) {
log.Printf("%+v\n", resp1)
log.Println("==========通过 ID 获取用户信息==========")
resp2, _ := client.Detail("60a6f9ad5bcccc51834950c5")
log.Printf("%+v\n", resp2)
log.Printf("%+v\n", resp2)*/
}
func TestClient_GetOrganizationList(t *testing.T) {
client := NewClient(userPoolId, appSecret)
Expand Down
22 changes: 19 additions & 3 deletions lib/model/vo_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ type UserDetailResponse struct {
}

type ExportAllOrganizationResponse struct {
Message string `json:"message"`
Code int64 `json:"code"`
Data []Node `json:"data"`
Message string `json:"message"`
Code int64 `json:"code"`
Data []OrgNode `json:"data"`
}

type NodeByIdDetail struct {
Expand Down Expand Up @@ -128,3 +128,19 @@ type OidcParams struct {
CodeChallengeMethod string
CodeChallenge string
}

type OrgNode struct {
Id string `json:"id"`
OrgId *string `json:"orgId"`
CreatedAt *string `json:"createdAt"`
UpdatedAt *string `json:"updatedAt"`
UserPoolId *string `json:"userPoolId"`
Name string `json:"name"`
NameI18n *string `json:"nameI18n"`
Description *string `json:"description"`
DescriptionI18n *string `json:"descriptionI18n"`
Order *int64 `json:"order"`
Code *string `json:"code"`
Members []User `json:"members"`
Children []OrgNode `json:"children"`
}

0 comments on commit bbf5d8f

Please sign in to comment.