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

feature. add api to audit #428

Merged
merged 1 commit into from
Apr 25, 2024
Merged
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
38 changes: 36 additions & 2 deletions api/swagger/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4144,6 +4144,12 @@ const docTemplate = `{
"in": "path",
"required": true
},
{
"type": "string",
"description": "filledParameter",
"name": "filledParameter",
"in": "query"
},
{
"type": "string",
"description": "pageSize",
Expand Down Expand Up @@ -9256,7 +9262,10 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": "OK"
"description": "OK",
"schema": {
"$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.DeleteSystemNotificationRuleResponse"
}
}
}
}
Expand Down Expand Up @@ -10060,7 +10069,10 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": "OK"
"description": "OK",
"schema": {
"$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.DeleteUserResponse"
}
}
}
}
Expand Down Expand Up @@ -12416,6 +12428,17 @@ const docTemplate = `{
}
}
},
"github_com_openinfradev_tks-api_pkg_domain.DeleteSystemNotificationRuleResponse": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"github_com_openinfradev_tks-api_pkg_domain.DeleteUserRequest": {
"type": "object",
"properties": {
Expand All @@ -12424,6 +12447,14 @@ const docTemplate = `{
}
}
},
"github_com_openinfradev_tks-api_pkg_domain.DeleteUserResponse": {
"type": "object",
"properties": {
"accountId": {
"type": "string"
}
}
},
"github_com_openinfradev_tks-api_pkg_domain.EndpointResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -14950,6 +14981,9 @@ const docTemplate = `{
"github_com_openinfradev_tks-api_pkg_domain.StackResponse": {
"type": "object",
"properties": {
"appServeAppCnt": {
"type": "integer"
},
"cloudAccount": {
"$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleCloudAccountResponse"
},
Expand Down
38 changes: 36 additions & 2 deletions api/swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -4138,6 +4138,12 @@
"in": "path",
"required": true
},
{
"type": "string",
"description": "filledParameter",
"name": "filledParameter",
"in": "query"
},
{
"type": "string",
"description": "pageSize",
Expand Down Expand Up @@ -9250,7 +9256,10 @@
],
"responses": {
"200": {
"description": "OK"
"description": "OK",
"schema": {
"$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.DeleteSystemNotificationRuleResponse"
}
}
}
}
Expand Down Expand Up @@ -10054,7 +10063,10 @@
],
"responses": {
"200": {
"description": "OK"
"description": "OK",
"schema": {
"$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.DeleteUserResponse"
}
}
}
}
Expand Down Expand Up @@ -12410,6 +12422,17 @@
}
}
},
"github_com_openinfradev_tks-api_pkg_domain.DeleteSystemNotificationRuleResponse": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"github_com_openinfradev_tks-api_pkg_domain.DeleteUserRequest": {
"type": "object",
"properties": {
Expand All @@ -12418,6 +12441,14 @@
}
}
},
"github_com_openinfradev_tks-api_pkg_domain.DeleteUserResponse": {
"type": "object",
"properties": {
"accountId": {
"type": "string"
}
}
},
"github_com_openinfradev_tks-api_pkg_domain.EndpointResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -14944,6 +14975,9 @@
"github_com_openinfradev_tks-api_pkg_domain.StackResponse": {
"type": "object",
"properties": {
"appServeAppCnt": {
"type": "integer"
},
"cloudAccount": {
"$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleCloudAccountResponse"
},
Expand Down
22 changes: 22 additions & 0 deletions api/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1479,11 +1479,23 @@ definitions:
type: string
type: array
type: object
github_com_openinfradev_tks-api_pkg_domain.DeleteSystemNotificationRuleResponse:
properties:
id:
type: string
name:
type: string
type: object
github_com_openinfradev_tks-api_pkg_domain.DeleteUserRequest:
properties:
adminPassword:
type: string
type: object
github_com_openinfradev_tks-api_pkg_domain.DeleteUserResponse:
properties:
accountId:
type: string
type: object
github_com_openinfradev_tks-api_pkg_domain.EndpointResponse:
properties:
group:
Expand Down Expand Up @@ -3151,6 +3163,8 @@ definitions:
type: object
github_com_openinfradev_tks-api_pkg_domain.StackResponse:
properties:
appServeAppCnt:
type: integer
cloudAccount:
$ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleCloudAccountResponse'
conf:
Expand Down Expand Up @@ -6946,6 +6960,10 @@ paths:
name: organizationId
required: true
type: string
- description: filledParameter
in: query
name: filledParameter
type: string
- description: pageSize
in: query
name: pageSize
Expand Down Expand Up @@ -10139,6 +10157,8 @@ paths:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.DeleteSystemNotificationRuleResponse'
security:
- JWT: []
summary: Delete SystemNotificationRule
Expand Down Expand Up @@ -10648,6 +10668,8 @@ paths:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.DeleteUserResponse'
security:
- JWT: []
summary: Delete user
Expand Down
14 changes: 10 additions & 4 deletions internal/delivery/http/cloud-account.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,18 @@ func (h *CloudAccountHandler) DeleteCloudAccount(w http.ResponseWriter, r *http.
}
dto.ID = parsedId

err = h.usecase.Delete(r.Context(), dto)
cloudAccount, err := h.usecase.Delete(r.Context(), dto)
if err != nil {
ErrorJSON(w, r, err)
return
}

ResponseJSON(w, r, http.StatusOK, nil)
out := domain.DeleteCloudAccountResponse{
ID: cloudAccount.ID.String(),
Name: cloudAccount.Name,
}

ResponseJSON(w, r, http.StatusOK, out)
}

// DeleteForceCloudAccount godoc
Expand Down Expand Up @@ -300,14 +305,15 @@ func (h *CloudAccountHandler) DeleteForceCloudAccount(w http.ResponseWriter, r *
return
}

err = h.usecase.DeleteForce(r.Context(), parsedId)
cloudAccount, err := h.usecase.DeleteForce(r.Context(), parsedId)
if err != nil {
ErrorJSON(w, r, err)
return
}

out := domain.DeleteCloudAccountResponse{
ID: cloudAccountId,
ID: cloudAccount.ID.String(),
Name: cloudAccount.Name,
}

ResponseJSON(w, r, http.StatusOK, out)
Expand Down
12 changes: 9 additions & 3 deletions internal/delivery/http/system-notification-rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func (h *SystemNotificationRuleHandler) UpdateSystemNotificationRule(w http.Resp
// @Produce json
// @Param organizationId path string true "organizationId"
// @Param systemNotificationRuleId path string true "systemNotificationRuleId"
// @Success 200 {object} nil
// @Success 200 {object} domain.DeleteSystemNotificationRuleResponse
// @Router /organizations/{organizationId}/system-notification-rules/{systemNotificationRuleId} [delete]
// @Security JWT
func (h *SystemNotificationRuleHandler) DeleteSystemNotificationRule(w http.ResponseWriter, r *http.Request) {
Expand All @@ -272,12 +272,18 @@ func (h *SystemNotificationRuleHandler) DeleteSystemNotificationRule(w http.Resp
return
}

err = h.usecase.Delete(r.Context(), systemNotificationRuleId)
systemNotificationRule, err := h.usecase.Delete(r.Context(), systemNotificationRuleId)
if err != nil {
ErrorJSON(w, r, err)
return
}
ResponseJSON(w, r, http.StatusOK, nil)

out := domain.DeleteSystemNotificationRuleResponse{
ID: strId,
Name: systemNotificationRule.Name,
}

ResponseJSON(w, r, http.StatusOK, out)
}

// CheckSystemNotificationRuleName godoc
Expand Down
7 changes: 5 additions & 2 deletions internal/delivery/http/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func (u UserHandler) convertUserRolesToSimpleRoleResponse(roles []model.Role) []
// @Produce json
// @Param organizationId path string true "organizationId"
// @Param accountId path string true "accountId"
// @Success 200 {object} nil
// @Success 200 {object} domain.DeleteUserResponse
// @Router /organizations/{organizationId}/users/{accountId} [delete]
// @Security JWT
func (u UserHandler) Delete(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -277,7 +277,10 @@ func (u UserHandler) Delete(w http.ResponseWriter, r *http.Request) {
return
}

ResponseJSON(w, r, http.StatusOK, nil)
out := domain.DeleteUserResponse{
AccountId: userId,
}
ResponseJSON(w, r, http.StatusOK, out)
}

// Update godoc
Expand Down
Loading
Loading