From ec0155281894eafd8680c3d1a187d220660bc4b2 Mon Sep 17 00:00:00 2001 From: kingChan <281221230@qq.com> Date: Thu, 20 Jun 2024 14:10:51 +0800 Subject: [PATCH] add has_actions to projects --- .../api/v1/sonarqubes_controller.rb | 1 + app/models/action/node.rb | 6 +- app/models/action/node_input.rb | 2 +- app/models/action/node_type.rb | 2 +- app/models/action/template.rb | 2 +- app/models/attachment.rb | 83 +++++++++---------- app/models/gitlink_competition_apply.rb | 20 +++++ app/models/license.rb | 1 - app/models/member.rb | 1 - app/models/organization_user.rb | 1 - app/models/project.rb | 1 + app/models/project_category.rb | 1 - app/models/project_language.rb | 4 - app/models/repository.rb | 1 - app/models/sync_repositories/gitee.rb | 2 + app/models/sync_repositories/github.rb | 2 + app/models/token.rb | 31 +++---- app/models/user_extension.rb | 4 +- config/configuration.yml.example | 4 +- ...40620060536_add_has_actions_to_projects.rb | 5 ++ 20 files changed, 99 insertions(+), 75 deletions(-) create mode 100644 db/migrate/20240620060536_add_has_actions_to_projects.rb diff --git a/app/controllers/api/v1/sonarqubes_controller.rb b/app/controllers/api/v1/sonarqubes_controller.rb index 0c64ba7ba..d42593a33 100644 --- a/app/controllers/api/v1/sonarqubes_controller.rb +++ b/app/controllers/api/v1/sonarqubes_controller.rb @@ -10,6 +10,7 @@ class Api::V1::SonarqubesController < Api::V1::BaseController Gitea::Repository::ActionSecretsService.new(@owner, @project.identifier, 'SONAR_HOST_URL', Rails.application.config_for(:configuration)['sonarqube']['url'] ).destroy Gitea::Repository::ActionSecretsService.new(@owner, @project.identifier, 'SONAR_TOKEN', Rails.application.config_for(:configuration)['sonarqube']['secret'] ).destroy end + @project.update(gitea_params) render_ok end diff --git a/app/models/action/node.rb b/app/models/action/node.rb index a761a0216..79c54293d 100644 --- a/app/models/action/node.rb +++ b/app/models/action/node.rb @@ -16,12 +16,12 @@ # user_id :integer # created_at :datetime not null # updated_at :datetime not null +# label :string(255) # # Indexes # -# by_name (name) -# index_action_nodes_on_action_types_id (action_node_types_id) -# index_action_nodes_on_user_id (user_id) +# index_action_nodes_on_action_node_types_id (action_node_types_id) +# index_action_nodes_on_user_id (user_id) # class Action::Node < ApplicationRecord diff --git a/app/models/action/node_input.rb b/app/models/action/node_input.rb index 7dc475a2e..3710e1633 100644 --- a/app/models/action/node_input.rb +++ b/app/models/action/node_input.rb @@ -8,7 +8,7 @@ # input_type :string(255) # description :string(255) # is_required :boolean default("0") -# sort_no :string(255) default("0") +# sort_no :integer default("0") # user_id :integer # created_at :datetime not null # updated_at :datetime not null diff --git a/app/models/action/node_type.rb b/app/models/action/node_type.rb index 59f4ab9de..64d9eabce 100644 --- a/app/models/action/node_type.rb +++ b/app/models/action/node_type.rb @@ -5,7 +5,7 @@ # id :integer not null, primary key # name :string(255) # description :string(255) -# sort_no :integer +# sort_no :integer default("0") # created_at :datetime not null # updated_at :datetime not null # diff --git a/app/models/action/template.rb b/app/models/action/template.rb index d854e8854..d256c7f67 100644 --- a/app/models/action/template.rb +++ b/app/models/action/template.rb @@ -6,7 +6,7 @@ # name :string(255) # description :string(255) # img :string(255) -# sort_no :string(255) default("0") +# sort_no :integer default("0") # json :text(65535) # yaml :text(65535) # created_at :datetime not null diff --git a/app/models/attachment.rb b/app/models/attachment.rb index be715921b..a201faa30 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -1,45 +1,44 @@ -# == Schema Information -# -# Table name: attachments -# -# id :integer not null, primary key -# container_id :integer -# container_type :string(30) -# filename :string(255) default(""), not null -# disk_filename :string(255) default(""), not null -# filesize :integer default("0"), not null -# content_type :string(255) default("") -# digest :string(60) default(""), not null -# downloads :integer default("0"), not null -# author_id :integer default("0"), not null -# created_on :datetime -# description :text(65535) -# disk_directory :string(255) -# attachtype :integer default("1") -# is_public :integer default("1") -# copy_from :integer -# quotes :integer default("0") -# is_publish :integer default("1") -# publish_time :datetime -# resource_bank_id :integer -# unified_setting :boolean default("1") -# 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") -# uuid :string(255) -# -# Indexes -# -# index_attachments_on_author_id (author_id) -# index_attachments_on_container_id_and_container_type (container_id,container_type) -# index_attachments_on_course_second_category_id (course_second_category_id) -# index_attachments_on_created_on (created_on) -# index_attachments_on_is_public (is_public) -# index_attachments_on_quotes (quotes) -# index_attachments_on_uuid (uuid) -# +# == Schema Information +# +# Table name: attachments +# +# id :integer not null, primary key +# container_id :integer +# container_type :string(30) +# filename :string(255) default(""), not null +# disk_filename :string(255) default(""), not null +# filesize :integer default("0"), not null +# content_type :string(255) default("") +# digest :string(60) default(""), not null +# downloads :integer default("0"), not null +# author_id :integer default("0"), not null +# created_on :datetime +# description :text(65535) +# disk_directory :string(255) +# attachtype :integer default("1") +# is_public :integer default("1") +# copy_from :integer +# quotes :integer default("0") +# is_publish :integer default("1") +# publish_time :datetime +# resource_bank_id :integer +# unified_setting :boolean default("1") +# cloud_url :string(255) default("") +# course_second_category_id :integer default("0") +# delay_publish :boolean default("0") +# uuid :string(255) +# +# Indexes +# +# index_attachments_on_author_id (author_id) +# index_attachments_on_container_id_and_container_type (container_id,container_type) +# index_attachments_on_course_second_category_id (course_second_category_id) +# index_attachments_on_created_on (created_on) +# index_attachments_on_is_public (is_public) +# index_attachments_on_quotes (quotes) +# index_attachments_on_uuid (uuid) +# + diff --git a/app/models/gitlink_competition_apply.rb b/app/models/gitlink_competition_apply.rb index f3b7d4ce1..cc942bd45 100644 --- a/app/models/gitlink_competition_apply.rb +++ b/app/models/gitlink_competition_apply.rb @@ -1,3 +1,23 @@ +# == Schema Information +# +# Table name: gitlink_competition_applies +# +# id :integer not null, primary key +# competition_id :integer +# competition_identifier :string(255) +# team_id :integer +# team_name :string(255) +# school_name :string(255) +# educoder_login :string(255) +# nickname :string(255) +# phone :string(255) +# email :string(255) +# identity :string(255) +# role :string(255) +# created_at :datetime not null +# updated_at :datetime not null +# + # == Schema Information # # Table name: gitlink_competition_applies diff --git a/app/models/license.rb b/app/models/license.rb index f84e63573..d14a9db14 100644 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -7,7 +7,6 @@ # content :text(65535) # created_at :datetime not null # updated_at :datetime not null -# is_secret :boolean default("0") # class License < ApplicationRecord diff --git a/app/models/member.rb b/app/models/member.rb index aaaf34efc..521f939c5 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -11,7 +11,6 @@ # 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 diff --git a/app/models/organization_user.rb b/app/models/organization_user.rb index 900710a9a..4ff6946b7 100644 --- a/app/models/organization_user.rb +++ b/app/models/organization_user.rb @@ -5,7 +5,6 @@ # 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 # diff --git a/app/models/project.rb b/app/models/project.rb index 245537408..5bfe52c4c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -59,6 +59,7 @@ # is_pinned :boolean default("0") # recommend_index :integer default("0") # pr_view_admin :boolean default("0") +# has_actions :boolean default("0") # # Indexes # diff --git a/app/models/project_category.rb b/app/models/project_category.rb index bc6f8427d..97a304259 100644 --- a/app/models/project_category.rb +++ b/app/models/project_category.rb @@ -15,7 +15,6 @@ # Indexes # # index_project_categories_on_ancestry (ancestry) -# index_project_categories_on_id (id) # class ProjectCategory < ApplicationRecord diff --git a/app/models/project_language.rb b/app/models/project_language.rb index 22a4a81ff..0770a1efa 100644 --- a/app/models/project_language.rb +++ b/app/models/project_language.rb @@ -9,10 +9,6 @@ # created_at :datetime not null # updated_at :datetime not null # -# Indexes -# -# index_project_languages_on_id (id) -# class ProjectLanguage < ApplicationRecord include Projectable diff --git a/app/models/repository.rb b/app/models/repository.rb index 7d3f207ea..f2815dde7 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -27,7 +27,6 @@ # # Indexes # -# index_name (project_id) # index_repositories_on_identifier (identifier) # index_repositories_on_project_id (project_id) # index_repositories_on_user_id (user_id) diff --git a/app/models/sync_repositories/gitee.rb b/app/models/sync_repositories/gitee.rb index 0a51b21c8..29309c99b 100644 --- a/app/models/sync_repositories/gitee.rb +++ b/app/models/sync_repositories/gitee.rb @@ -11,6 +11,8 @@ # sync_direction :integer # created_at :datetime not null # updated_at :datetime not null +# external_token :string(255) +# webhook_gid :integer # # Indexes # diff --git a/app/models/sync_repositories/github.rb b/app/models/sync_repositories/github.rb index 1ef413a54..10845dea7 100644 --- a/app/models/sync_repositories/github.rb +++ b/app/models/sync_repositories/github.rb @@ -11,6 +11,8 @@ # sync_direction :integer # created_at :datetime not null # updated_at :datetime not null +# external_token :string(255) +# webhook_gid :integer # # Indexes # diff --git a/app/models/token.rb b/app/models/token.rb index 7d65f32a3..9b9ea5895 100644 --- a/app/models/token.rb +++ b/app/models/token.rb @@ -1,18 +1,19 @@ -# == Schema Information -# -# Table name: tokens -# -# id :integer not null, primary key -# user_id :integer default("0"), not null -# action :string(30) default(""), not null -# value :string(40) default(""), not null -# created_on :datetime not null -# -# Indexes -# -# index_tokens_on_user_id (user_id) -# tokens_value (value) UNIQUE -# +# == Schema Information +# +# Table name: tokens +# +# id :integer not null, primary key +# user_id :integer default("0"), not null +# action :string(30) default(""), not null +# value :string(40) default(""), not null +# created_on :datetime not null +# +# Indexes +# +# index_tokens_on_user_id (user_id) +# tokens_value (value) UNIQUE +# + # diff --git a/app/models/user_extension.rb b/app/models/user_extension.rb index aeb9a9d83..ef4af5fd3 100644 --- a/app/models/user_extension.rb +++ b/app/models/user_extension.rb @@ -22,9 +22,9 @@ # school_id :integer # description :string(255) # department_id :integer -# province :text(65535) -# custom_department :string(255) +# province :string(255) # city :string(255) +# custom_department :string(255) # show_email :boolean default("0") # show_location :boolean default("0") # show_department :boolean default("0") diff --git a/config/configuration.yml.example b/config/configuration.yml.example index f5f17f59c..c18cf544c 100644 --- a/config/configuration.yml.example +++ b/config/configuration.yml.example @@ -53,7 +53,9 @@ default: &default # 区块链相关配置 blockchain: api_url: 'blockchain service url' - + sonarqube: + url: '' + secret: '' production: <<: *default diff --git a/db/migrate/20240620060536_add_has_actions_to_projects.rb b/db/migrate/20240620060536_add_has_actions_to_projects.rb new file mode 100644 index 000000000..f4b4fc164 --- /dev/null +++ b/db/migrate/20240620060536_add_has_actions_to_projects.rb @@ -0,0 +1,5 @@ +class AddHasActionsToProjects < ActiveRecord::Migration[5.2] + def change + add_column :projects , :has_actions, :boolean, default: false + end +end