add data_bank to user action

This commit is contained in:
呱呱呱 2023-10-10 13:49:52 +08:00
parent b92fdb8388
commit 6cb7af0401
15 changed files with 28 additions and 5 deletions

View File

@ -31,6 +31,7 @@ class Admins::OrganizationsController < Admins::BaseController
def destroy
@org.destroy!
Admins::DeleteOrganizationService.call(@org.login)
UserAction.create(action_id: @org.id, action_type: "DestroyOrganization", user_id: current_user.id, :ip => request.remote_ip, data_bank: @org.attributes.to_json)
render_delete_success
end

View File

@ -35,6 +35,7 @@ class Admins::ProjectsController < Admins::BaseController
Gitea::Repository::DeleteService.new(project.owner, project.identifier).call
project.destroy!
# render_delete_success
UserAction.create(action_id: project.id, action_type: "DestroyProject", user_id: current_user.id, :ip => request.remote_ip, data_bank: project.attributes.to_json)
redirect_to admins_projects_path
flash[:success] = "删除成功"
end

View File

@ -25,15 +25,16 @@ class Admins::UsersController < Admins::BaseController
end
def destroy
UserAction.create(action_id: @user.id, action_type: "DestroyUser", user_id: current_user.id, :ip => request.remote_ip, data_bank: @user.attributes.to_json)
@user.destroy!
Gitea::User::DeleteService.call(@user.login)
render_delete_success
end
def lock
@user.lock!
UserAction.create(action_id: @user.id, action_type: "LockUser", user_id: current_user.id, :ip => request.remote_ip)
render_ok
end

View File

@ -26,6 +26,8 @@
# cloud_url :string(255) default("")
# course_second_category_id :integer default("0")
# delay_publish :boolean default("0")
# memo_image :boolean default("0")
# extra_type :integer default("0")
#
# Indexes
#

View File

@ -17,7 +17,7 @@
#
# Indexes
#
# index_identity_verifications_on_number (number)
# index_identity_verifications_on_user_id (user_id)
#
class IdentityVerification < ApplicationRecord

View File

@ -7,6 +7,7 @@
# content :text(65535)
# created_at :datetime not null
# updated_at :datetime not null
# is_secret :boolean default("0")
#
class License < ApplicationRecord

View File

@ -11,6 +11,7 @@
# course_group_id :integer default("0")
# is_collect :integer default("1")
# graduation_group_id :integer default("0")
# is_apply_signature :boolean default("0")
# team_user_id :integer
#
# Indexes

View File

@ -5,6 +5,7 @@
# id :integer not null, primary key
# user_id :integer
# organization_id :integer
# is_creator :boolean default("0")
# created_at :datetime not null
# updated_at :datetime not null
#

View File

@ -62,6 +62,7 @@
#
# Indexes
#
# index_projects_on_forked_count (forked_count)
# index_projects_on_forked_from_project_id (forked_from_project_id)
# index_projects_on_identifier (identifier)
# index_projects_on_invite_code (invite_code)
@ -71,6 +72,7 @@
# index_projects_on_license_id (license_id)
# index_projects_on_name (name)
# index_projects_on_platform (platform)
# index_projects_on_praises_count (praises_count)
# index_projects_on_project_category_id (project_category_id)
# index_projects_on_project_language_id (project_language_id)
# index_projects_on_project_type (project_type)
@ -78,6 +80,7 @@
# index_projects_on_rgt (rgt)
# index_projects_on_status (status)
# index_projects_on_updated_on (updated_on)
# index_projects_on_user_id (user_id)
#
class Project < ApplicationRecord

View File

@ -15,6 +15,7 @@
# Indexes
#
# index_project_categories_on_ancestry (ancestry)
# index_project_categories_on_id (id)
#
class ProjectCategory < ApplicationRecord

View File

@ -9,6 +9,10 @@
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_project_languages_on_id (id)
#
class ProjectLanguage < ApplicationRecord
include Projectable

View File

@ -27,6 +27,7 @@
#
# Indexes
#
# index_name (project_id)
# index_repositories_on_identifier (identifier)
# index_repositories_on_project_id (project_id)
# index_repositories_on_user_id (user_id)

View File

@ -9,6 +9,7 @@
# created_at :datetime not null
# updated_at :datetime not null
# ip :string(255)
# data_bank :text(65535)
#
# Indexes
#

View File

@ -22,9 +22,9 @@
# school_id :integer
# description :string(255)
# department_id :integer
# province :string(255)
# city :string(255)
# province :text(65535)
# custom_department :string(255)
# city :string(255)
# show_email :boolean default("0")
# show_location :boolean default("0")
# show_department :boolean default("0")

View File

@ -0,0 +1,5 @@
class AddDataBankToUserActions < ActiveRecord::Migration[5.2]
def change
add_column :user_actions, :data_bank, :text
end
end