forgeplus/app/models/applied_project.rb

34 lines
1.2 KiB
Ruby
Raw Permalink Normal View History

2020-11-23 15:35:03 +08:00
# == Schema Information
#
# Table name: forge_applied_projects
2020-11-23 15:35:03 +08:00
#
2022-06-15 18:07:23 +08:00
# id :integer not null, primary key
# project_id :integer
# user_id :integer
# role :integer default("0")
# status :integer default("0")
# created_at :datetime not null
# updated_at :datetime not null
# project_invite_link_id :integer
#
# Indexes
#
2022-06-15 18:07:23 +08:00
# index_forge_applied_projects_on_project_id (project_id)
# index_forge_applied_projects_on_project_invite_link_id (project_invite_link_id)
# index_forge_applied_projects_on_user_id (user_id)
2020-11-23 15:35:03 +08:00
#
2020-03-09 00:40:16 +08:00
class AppliedProject < ApplicationRecord
2021-06-17 16:37:48 +08:00
self.table_name = "forge_applied_projects"
2020-03-09 00:40:16 +08:00
belongs_to :user
belongs_to :project
2022-06-15 18:07:23 +08:00
belongs_to :project_invite_link, optional: true
2020-03-09 00:40:16 +08:00
has_many :applied_messages, as: :applied, dependent: :destroy
2021-06-08 14:56:43 +08:00
# has_many :forge_activities, as: :forge_act, dependent: :destroy
2021-06-09 16:53:09 +08:00
enum role: {manager: 3, developer: 4, reporter: 5}
2021-06-08 14:56:43 +08:00
enum status: {canceled: -1, common: 0, accepted: 1, refused: 2} # -1 已取消 0 待操作 1 已接收 2 已拒绝
2020-03-09 00:40:16 +08:00
end