Skip to content

Commit

Permalink
Merge pull request #275 from actiontech/issue-269
Browse files Browse the repository at this point in the history
fix: swagger enum lose and swagger business definitions field lose fix
  • Loading branch information
LordofAvernus authored Jul 10, 2024
2 parents bdbb282 + 9a06413 commit a7d1750
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 18 deletions.
4 changes: 2 additions & 2 deletions api/dms/service/v1/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ type UpdateProject struct {
// is fixed business
IsFixedBusiness *bool `json:"is_fixed_business"`
// Project business
Business []Business `json:"business"`
Business []BusinessForUpdate `json:"business"`
}

type Business struct {
type BusinessForUpdate struct {
ID string `json:"id"`
Name string `json:"name"`
}
Expand Down
34 changes: 27 additions & 7 deletions api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@
{
"type": "file",
"description": "file upload",
"name": "formData",
"name": "file",
"in": "formData"
}
],
Expand Down Expand Up @@ -4954,6 +4954,24 @@
"x-go-package": "github.com/actiontech/dms/api/dms/service/v1"
},
"Business": {
"type": "object",
"properties": {
"id": {
"type": "string",
"x-go-name": "Id"
},
"is_used": {
"type": "boolean",
"x-go-name": "IsUsed"
},
"name": {
"type": "string",
"x-go-name": "Name"
}
},
"x-go-package": "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
},
"BusinessForUpdate": {
"type": "object",
"properties": {
"id": {
Expand Down Expand Up @@ -6375,14 +6393,15 @@
"$ref": "#/definitions/AccessTokenInfo"
},
"authentication_type": {
"description": "user authentication type\nldap UserAuthenticationTypeLDAP\noauth2 UserAuthenticationTypeOAUTH2\nunknown UserAuthenticationTypeUnknown",
"description": "user authentication type\nldap UserAuthenticationTypeLDAP\ndms UserAuthenticationTypeDMS\noauth2 UserAuthenticationTypeOAUTH2\nunknown UserAuthenticationTypeUnknown",
"type": "string",
"enum": [
"ldap",
"dms",
"oauth2",
"unknown"
],
"x-go-enum-desc": "ldap UserAuthenticationTypeLDAP\noauth2 UserAuthenticationTypeOAUTH2\nunknown UserAuthenticationTypeUnknown",
"x-go-enum-desc": "ldap UserAuthenticationTypeLDAP\ndms UserAuthenticationTypeDMS\noauth2 UserAuthenticationTypeOAUTH2\nunknown UserAuthenticationTypeUnknown",
"x-go-name": "AuthenticationType"
},
"email": {
Expand Down Expand Up @@ -7983,14 +8002,15 @@
"type": "object",
"properties": {
"authentication_type": {
"description": "user authentication type\nldap UserAuthenticationTypeLDAP\noauth2 UserAuthenticationTypeOAUTH2\nunknown UserAuthenticationTypeUnknown",
"description": "user authentication type\nldap UserAuthenticationTypeLDAP\ndms UserAuthenticationTypeDMS\noauth2 UserAuthenticationTypeOAUTH2\nunknown UserAuthenticationTypeUnknown",
"type": "string",
"enum": [
"ldap",
"dms",
"oauth2",
"unknown"
],
"x-go-enum-desc": "ldap UserAuthenticationTypeLDAP\noauth2 UserAuthenticationTypeOAUTH2\nunknown UserAuthenticationTypeUnknown",
"x-go-enum-desc": "ldap UserAuthenticationTypeLDAP\ndms UserAuthenticationTypeDMS\noauth2 UserAuthenticationTypeOAUTH2\nunknown UserAuthenticationTypeUnknown",
"x-go-name": "AuthenticationType"
},
"email": {
Expand Down Expand Up @@ -9095,7 +9115,7 @@
"x-go-name": "Uid"
}
},
"x-go-package": "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
"x-go-package": "github.com/actiontech/dms/api/dms/service/v1"
},
"UpdateCompanyNotice": {
"description": "A companynotice",
Expand Down Expand Up @@ -9389,7 +9409,7 @@
"description": "Project business",
"type": "array",
"items": {
"$ref": "#/definitions/Business"
"$ref": "#/definitions/BusinessForUpdate"
},
"x-go-name": "Business"
},
Expand Down
25 changes: 22 additions & 3 deletions api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,19 @@ definitions:
type: object
x-go-package: github.com/actiontech/dms/api/dms/service/v1
Business:
properties:
id:
type: string
x-go-name: Id
is_used:
type: boolean
x-go-name: IsUsed
name:
type: string
x-go-name: Name
type: object
x-go-package: github.com/actiontech/dms/pkg/dms-common/api/dms/v1
BusinessForUpdate:
properties:
id:
type: string
Expand Down Expand Up @@ -1566,15 +1579,18 @@ definitions:
description: |-
user authentication type
ldap UserAuthenticationTypeLDAP
dms UserAuthenticationTypeDMS
oauth2 UserAuthenticationTypeOAUTH2
unknown UserAuthenticationTypeUnknown
enum:
- ldap
- dms
- oauth2
- unknown
type: string
x-go-enum-desc: |-
ldap UserAuthenticationTypeLDAP
dms UserAuthenticationTypeDMS
oauth2 UserAuthenticationTypeOAUTH2
unknown UserAuthenticationTypeUnknown
x-go-name: AuthenticationType
Expand Down Expand Up @@ -2829,15 +2845,18 @@ definitions:
description: |-
user authentication type
ldap UserAuthenticationTypeLDAP
dms UserAuthenticationTypeDMS
oauth2 UserAuthenticationTypeOAUTH2
unknown UserAuthenticationTypeUnknown
enum:
- ldap
- dms
- oauth2
- unknown
type: string
x-go-enum-desc: |-
ldap UserAuthenticationTypeLDAP
dms UserAuthenticationTypeDMS
oauth2 UserAuthenticationTypeOAUTH2
unknown UserAuthenticationTypeUnknown
x-go-name: AuthenticationType
Expand Down Expand Up @@ -3735,7 +3754,7 @@ definitions:
type: string
x-go-name: Uid
type: object
x-go-package: github.com/actiontech/dms/pkg/dms-common/api/dms/v1
x-go-package: github.com/actiontech/dms/api/dms/service/v1
UpdateCompanyNotice:
description: A companynotice
properties:
Expand Down Expand Up @@ -3951,7 +3970,7 @@ definitions:
business:
description: Project business
items:
$ref: '#/definitions/Business'
$ref: '#/definitions/BusinessForUpdate'
type: array
x-go-name: Business
desc:
Expand Down Expand Up @@ -4967,7 +4986,7 @@ paths:
type: string
- description: file upload
in: formData
name: formData
name: file
type: file
responses:
"200":
Expand Down
2 changes: 1 addition & 1 deletion internal/apiserver/service/dms_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ func (d *DMSController) GetStaticLogo(c echo.Context) error {
// in: formData
// required: false
// type: string
// - name: formData
// - name: file
// description: file upload
// in: formData
// required: false
Expand Down
2 changes: 1 addition & 1 deletion internal/dms/biz/project_ce.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (d *ProjectUsecase) PreviewImportProjects(ctx context.Context, uid, file st
return nil, errNotSupportProject
}

func (d *ProjectUsecase) UpdateProject(ctx context.Context, currentUserUid, projectUid string, desc *string, isFixBusiness *bool, business []v1.Business) (err error) {
func (d *ProjectUsecase) UpdateProject(ctx context.Context, currentUserUid, projectUid string, desc *string, isFixBusiness *bool, business []v1.BusinessForUpdate) (err error) {
return errNotSupportProject
}

Expand Down
7 changes: 3 additions & 4 deletions pkg/dms-common/api/dms/v1/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"

base "github.com/actiontech/dms/pkg/dms-common/api/base/v1"
_const "github.com/actiontech/dms/pkg/dms-common/pkg/const"
)

// swagger:parameters GetUser
Expand Down Expand Up @@ -73,9 +72,9 @@ type UidWithName struct {
type UserAuthenticationType string

const (
UserAuthenticationTypeLDAP UserAuthenticationType = "ldap" // user verify through ldap
UserAuthenticationTypeDMS UserAuthenticationType = _const.DmsComponentName // user verify through dms
UserAuthenticationTypeOAUTH2 UserAuthenticationType = "oauth2" // user verify through oauth2
UserAuthenticationTypeLDAP UserAuthenticationType = "ldap" // user verify through ldap
UserAuthenticationTypeDMS UserAuthenticationType = "dms" // user verify through dms
UserAuthenticationTypeOAUTH2 UserAuthenticationType = "oauth2" // user verify through oauth2
UserAuthenticationTypeUnknown UserAuthenticationType = "unknown"
)

Expand Down

0 comments on commit a7d1750

Please sign in to comment.