forked from Gitlink/forgeplus
add: user pinned projects
This commit is contained in:
parent
422fd35f1e
commit
ea79772bd2
|
@ -0,0 +1,27 @@
|
|||
class Users::IsPinnedProjectsController < Users::BaseController
|
||||
before_action :private_user_resources!, only: [:pin]
|
||||
def index
|
||||
@is_pinned_projects = observed_user.is_pinned_projects.includes(:project_category, :project_language, :repository).order(position: :desc)
|
||||
@is_pinned_projects = kaminari_paginate(@is_pinned_projects)
|
||||
end
|
||||
|
||||
def pin
|
||||
observed_user.is_pinned_project_ids = is_pinned_project_ids
|
||||
render_ok
|
||||
rescue ActiveRecord::RecordNotFound => e
|
||||
render_not_found
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
private
|
||||
def is_pinned_project_ids
|
||||
if params[:is_pinned_project_ids].present?
|
||||
return params[:is_pinned_project_ids].select{|id| observed_user.full_member_projects.pluck(:id).include?(id.to_i) }
|
||||
end
|
||||
if params[:is_pinned_project_id].present?
|
||||
return observed_user.is_pinned_project_ids.include?(params[:is_pinned_project_id].to_i) ? observed_user.is_pinned_project_ids : observed_user.is_pinned_project_ids.push(params[:is_pinned_project_id].to_i)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,7 +1,7 @@
|
|||
<!--
|
||||
* @Date: 2021-03-01 10:35:21
|
||||
* @LastEditors: viletyy
|
||||
* @LastEditTime: 2021-05-27 10:27:14
|
||||
* @LastEditTime: 2021-05-27 14:22:52
|
||||
* @FilePath: /forgeplus/app/docs/slate/source/includes/_users.md
|
||||
-->
|
||||
# Users
|
||||
|
@ -47,6 +47,135 @@ await octokit.request('GET /api/users/me.json')
|
|||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 获取用户星标项目
|
||||
获取用户星标项目
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET http://localhost:3000/api/users/yystopf/is_pinned_projects.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/users/:login/is_pinned_projects.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET api/users/:login/is_pinned_projects.json`
|
||||
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|total_count |int |星标项目数量 |
|
||||
|identifier |string |项目标识 |
|
||||
|name |string |项目名称 |
|
||||
|description |string |项目描述 |
|
||||
|visits |int |项目访问数量|
|
||||
|praises_count |int |项目点赞数量|
|
||||
|watchers_count |int |项目关注数量|
|
||||
|issues_count |int |项目issue数量|
|
||||
|pull_requests_count |int |项目合并请求数量|
|
||||
|forked_count |int |项目复刻数量|
|
||||
|is_public |bool |项目是否公开|
|
||||
|mirror_url |string |镜像地址|
|
||||
|type |int |项目类型 0 普通项目 1 普通镜像项目 2 同步镜像项目|
|
||||
|time_ago |string |上次更新时间|
|
||||
|open_devops |int |是否开启devops|
|
||||
|forked_from_project_id |int |fork项目id|
|
||||
|platform |string |项目平台|
|
||||
|author.name |string |项目拥有者名称|
|
||||
|author.type |string |项目拥有者类型|
|
||||
|author.login |string |项目拥有者用户名|
|
||||
|author.image_url |string |项目拥有者头像|
|
||||
|category.name |string |项目分类名称|
|
||||
|language.name |string |项目语言名称|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"total_count": 1,
|
||||
"projects": [
|
||||
{
|
||||
"id": 89,
|
||||
"repo_id": 89,
|
||||
"identifier": "monkey",
|
||||
"name": "boke",
|
||||
"description": "dkkd",
|
||||
"visits": 4,
|
||||
"praises_count": 0,
|
||||
"watchers_count": 0,
|
||||
"issues_count": 0,
|
||||
"pull_requests_count": 0,
|
||||
"forked_count": 0,
|
||||
"is_public": true,
|
||||
"mirror_url": "https://github.com/viletyy/monkey.git",
|
||||
"type": 1,
|
||||
"last_update_time": 1619685144,
|
||||
"time_ago": "27天前",
|
||||
"forked_from_project_id": null,
|
||||
"open_devops": false,
|
||||
"platform": "forge",
|
||||
"author": {
|
||||
"name": "测试组织",
|
||||
"type": "Organization",
|
||||
"login": "ceshi_org",
|
||||
"image_url": "images/avatars/Organization/9?t=1612706073"
|
||||
},
|
||||
"category": {
|
||||
"id": 3,
|
||||
"name": "深度学习"
|
||||
},
|
||||
"language": {
|
||||
"id": 2,
|
||||
"name": "C"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 用户添加星标项目
|
||||
用户添加星标项目
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST http://localhost:3000/api/users/yystopf/is_pinned_projects/pin.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/users/:login/is_pinned_projects/pin.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST /api/users/:login/is_pinned_projects/pin.json`
|
||||
|
||||
### 请求字段说明:
|
||||
#### 同时设定多个星标项目
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|is_pinned_project_ids |array |设定为星标项目的id |
|
||||
|
||||
#### 只设定一个星标项目
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|is_pinned_project_id |integer |设定为星标项目的id |
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "success"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## 获取用户贡献度
|
||||
获取用户贡献度
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: pinned_projects
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# user_id :integer
|
||||
# project_id :integer
|
||||
# position :integer default("0")
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_pinned_projects_on_project_id (project_id)
|
||||
# index_pinned_projects_on_user_id (user_id)
|
||||
#
|
||||
|
||||
class PinnedProject < ApplicationRecord
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :project
|
||||
end
|
|
@ -114,6 +114,8 @@ class Project < ApplicationRecord
|
|||
has_many :team_projects, dependent: :destroy
|
||||
has_many :project_units, dependent: :destroy
|
||||
has_one :applied_transfer_project,-> { order created_at: :desc }, dependent: :destroy
|
||||
has_many :pinned_projects, dependent: :destroy
|
||||
has_many :has_pinned_users, through: :pinned_projects, source: :user
|
||||
|
||||
after_save :check_project_members
|
||||
scope :project_statics_select, -> {select(:id,:name, :is_public, :identifier, :status, :project_type, :user_id, :forked_count, :visits, :project_category_id, :project_language_id, :license_id, :ignore_id, :watchers_count, :created_on)}
|
||||
|
|
|
@ -164,6 +164,9 @@ class User < Owner
|
|||
|
||||
has_many :organization_users, dependent: :destroy
|
||||
has_many :organizations, through: :organization_users
|
||||
has_many :pinned_projects, dependent: :destroy
|
||||
has_many :is_pinned_projects, through: :pinned_projects, source: :project
|
||||
accepts_nested_attributes_for :is_pinned_projects
|
||||
|
||||
# Groups and active users
|
||||
scope :active, lambda { where(status: STATUS_ACTIVE) }
|
||||
|
@ -195,6 +198,13 @@ class User < Owner
|
|||
validate :validate_sensitive_string
|
||||
validate :validate_password_length
|
||||
|
||||
# 用户参与的所有项目
|
||||
def full_member_projects
|
||||
normal_projects = Project.members_projects(self.id).to_sql
|
||||
org_projects = Project.joins(team_projects: [team: :team_users]).where(team_users: {user_id: self.id}).to_sql
|
||||
return Project.from("( #{ normal_projects} UNION #{ org_projects } ) AS projects").distinct
|
||||
end
|
||||
|
||||
def name
|
||||
login
|
||||
end
|
||||
|
|
|
@ -5,6 +5,9 @@ json.name project.name
|
|||
json.description Nokogiri::HTML(project.description).text
|
||||
json.visits project.visits
|
||||
json.praises_count project.praises_count.to_i
|
||||
json.watchers_count project.watchers_count.to_i
|
||||
json.issues_count project.issues_count.to_i
|
||||
json.pull_requests_count project.pull_requests_count.to_i
|
||||
json.forked_count project.forked_count.to_i
|
||||
json.is_public project.is_public
|
||||
json.mirror_url project.repository&.mirror_url
|
||||
|
|
|
@ -13,3 +13,4 @@ json.is_transfering @project.is_transfering
|
|||
json.transfer do
|
||||
json.partial! "/users/user_simple", locals: {user: @project&.applied_transfer_project&.owner}
|
||||
end
|
||||
json.is_pinned @project.has_pinned_users.include?(current_user)
|
|
@ -0,0 +1,4 @@
|
|||
json.total_count @is_pinned_projects.total_count
|
||||
json.projects @is_pinned_projects.each do |project|
|
||||
json.partial! "projects/project_detail", project: project
|
||||
end
|
|
@ -266,6 +266,11 @@ Rails.application.routes.draw do
|
|||
end
|
||||
end
|
||||
resources :headmaps, only: [:index]
|
||||
resources :is_pinned_projects, only: [:index] do
|
||||
collection do
|
||||
post :pin
|
||||
end
|
||||
end
|
||||
resources :organizations, only: [:index]
|
||||
# resources :projects, only: [:index]
|
||||
# resources :subjects, only: [:index]
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
class CreatePinnedProjects < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :pinned_projects do |t|
|
||||
t.references :user
|
||||
t.references :project
|
||||
t.integer :position, default: 0
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -331,6 +331,12 @@
|
|||
<li>
|
||||
<a href="#1ae74893b1" class="toc-h2 toc-link" data-title="获取当前登陆用户信息">获取当前登陆用户信息</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#16a4666845" class="toc-h2 toc-link" data-title="获取用户星标项目">获取用户星标项目</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#3064477f38" class="toc-h2 toc-link" data-title="用户添加星标项目">用户添加星标项目</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#04cb758654" class="toc-h2 toc-link" data-title="获取用户贡献度">获取用户贡献度</a>
|
||||
</li>
|
||||
|
@ -590,7 +596,7 @@ Success — a happy kitten is an authenticated kitten!
|
|||
<!--
|
||||
* @Date: 2021-03-01 10:35:21
|
||||
* @LastEditors: viletyy
|
||||
* @LastEditTime: 2021-05-27 10:27:14
|
||||
* @LastEditTime: 2021-05-27 14:22:52
|
||||
* @FilePath: /forgeplus/app/docs/slate/source/includes/_users.md
|
||||
-->
|
||||
<h1 id='users'>Users</h1><h2 id='1ae74893b1'>获取当前登陆用户信息</h2>
|
||||
|
@ -652,7 +658,235 @@ Success — a happy kitten is an authenticated kitten!
|
|||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
<h2 id='04cb758654'>获取用户贡献度</h2>
|
||||
<h2 id='16a4666845'>获取用户星标项目</h2>
|
||||
<p>获取用户星标项目</p>
|
||||
|
||||
<blockquote>
|
||||
<p>示例:</p>
|
||||
</blockquote>
|
||||
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> GET http://localhost:3000/api/users/yystopf/is_pinned_projects.json
|
||||
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/users/:login/is_pinned_projects.json</span><span class="dl">'</span><span class="p">)</span>
|
||||
</code></pre></div><h3 id='http-2'>HTTP 请求</h3>
|
||||
<p><code>GET api/users/:login/is_pinned_projects.json</code></p>
|
||||
<h3 id='7447e4874e-2'>返回字段说明:</h3>
|
||||
<table><thead>
|
||||
<tr>
|
||||
<th>参数</th>
|
||||
<th>类型</th>
|
||||
<th>字段说明</th>
|
||||
</tr>
|
||||
</thead><tbody>
|
||||
<tr>
|
||||
<td>total_count</td>
|
||||
<td>int</td>
|
||||
<td>星标项目数量</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>identifier</td>
|
||||
<td>string</td>
|
||||
<td>项目标识</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>name</td>
|
||||
<td>string</td>
|
||||
<td>项目名称</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>description</td>
|
||||
<td>string</td>
|
||||
<td>项目描述</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>visits</td>
|
||||
<td>int</td>
|
||||
<td>项目访问数量</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>praises_count</td>
|
||||
<td>int</td>
|
||||
<td>项目点赞数量</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>watchers_count</td>
|
||||
<td>int</td>
|
||||
<td>项目关注数量</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>issues_count</td>
|
||||
<td>int</td>
|
||||
<td>项目issue数量</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>pull_requests_count</td>
|
||||
<td>int</td>
|
||||
<td>项目合并请求数量</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>forked_count</td>
|
||||
<td>int</td>
|
||||
<td>项目复刻数量</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>is_public</td>
|
||||
<td>bool</td>
|
||||
<td>项目是否公开</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>mirror_url</td>
|
||||
<td>string</td>
|
||||
<td>镜像地址</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td>int</td>
|
||||
<td>项目类型 0 普通项目 1 普通镜像项目 2 同步镜像项目</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>time_ago</td>
|
||||
<td>string</td>
|
||||
<td>上次更新时间</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>open_devops</td>
|
||||
<td>int</td>
|
||||
<td>是否开启devops</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>forked_from_project_id</td>
|
||||
<td>int</td>
|
||||
<td>fork项目id</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>platform</td>
|
||||
<td>string</td>
|
||||
<td>项目平台</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>author.name</td>
|
||||
<td>string</td>
|
||||
<td>项目拥有者名称</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>author.type</td>
|
||||
<td>string</td>
|
||||
<td>项目拥有者类型</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>author.login</td>
|
||||
<td>string</td>
|
||||
<td>项目拥有者用户名</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>author.image_url</td>
|
||||
<td>string</td>
|
||||
<td>项目拥有者头像</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>category.name</td>
|
||||
<td>string</td>
|
||||
<td>项目分类名称</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>language.name</td>
|
||||
<td>string</td>
|
||||
<td>项目语言名称</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
|
||||
<blockquote>
|
||||
<p>返回的JSON示例:</p>
|
||||
</blockquote>
|
||||
<div class="highlight"><pre class="highlight json tab-json"><code><span class="p">{</span><span class="w">
|
||||
</span><span class="nl">"total_count"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"projects"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
|
||||
</span><span class="p">{</span><span class="w">
|
||||
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">89</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"repo_id"</span><span class="p">:</span><span class="w"> </span><span class="mi">89</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"identifier"</span><span class="p">:</span><span class="w"> </span><span class="s2">"monkey"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"boke"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"description"</span><span class="p">:</span><span class="w"> </span><span class="s2">"dkkd"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"visits"</span><span class="p">:</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"praises_count"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"watchers_count"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"issues_count"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"pull_requests_count"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"forked_count"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"is_public"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"mirror_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"https://github.com/viletyy/monkey.git"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"last_update_time"</span><span class="p">:</span><span class="w"> </span><span class="mi">1619685144</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"time_ago"</span><span class="p">:</span><span class="w"> </span><span class="s2">"27天前"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"forked_from_project_id"</span><span class="p">:</span><span class="w"> </span><span class="kc">null</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"open_devops"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"platform"</span><span class="p">:</span><span class="w"> </span><span class="s2">"forge"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"author"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
|
||||
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"测试组织"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Organization"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ceshi_org"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"image_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"images/avatars/Organization/9?t=1612706073"</span><span class="w">
|
||||
</span><span class="p">},</span><span class="w">
|
||||
</span><span class="nl">"category"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
|
||||
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">3</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"深度学习"</span><span class="w">
|
||||
</span><span class="p">},</span><span class="w">
|
||||
</span><span class="nl">"language"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
|
||||
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"C"</span><span class="w">
|
||||
</span><span class="p">}</span><span class="w">
|
||||
</span><span class="p">}</span><span class="w">
|
||||
</span><span class="p">]</span><span class="w">
|
||||
</span><span class="p">}</span><span class="w">
|
||||
</span></code></pre></div>
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
<h2 id='3064477f38'>用户添加星标项目</h2>
|
||||
<p>用户添加星标项目</p>
|
||||
|
||||
<blockquote>
|
||||
<p>示例:</p>
|
||||
</blockquote>
|
||||
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> POST http://localhost:3000/api/users/yystopf/is_pinned_projects/pin.json
|
||||
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/users/:login/is_pinned_projects/pin.json</span><span class="dl">'</span><span class="p">)</span>
|
||||
</code></pre></div><h3 id='http-3'>HTTP 请求</h3>
|
||||
<p><code>POST /api/users/:login/is_pinned_projects/pin.json</code></p>
|
||||
<h3 id='aa883f5d52'>请求字段说明:</h3><h4 id='0ca7f0efb8'>同时设定多个星标项目</h4>
|
||||
<table><thead>
|
||||
<tr>
|
||||
<th>参数</th>
|
||||
<th>类型</th>
|
||||
<th>字段说明</th>
|
||||
</tr>
|
||||
</thead><tbody>
|
||||
<tr>
|
||||
<td>is_pinned_project_ids</td>
|
||||
<td>array</td>
|
||||
<td>设定为星标项目的id</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
<h4 id='f4b9f10991'>只设定一个星标项目</h4>
|
||||
<table><thead>
|
||||
<tr>
|
||||
<th>参数</th>
|
||||
<th>类型</th>
|
||||
<th>字段说明</th>
|
||||
</tr>
|
||||
</thead><tbody>
|
||||
<tr>
|
||||
<td>is_pinned_project_id</td>
|
||||
<td>integer</td>
|
||||
<td>设定为星标项目的id</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
|
||||
<blockquote>
|
||||
<p>返回的JSON示例:</p>
|
||||
</blockquote>
|
||||
<div class="highlight"><pre class="highlight json tab-json"><code><span class="p">{</span><span class="w">
|
||||
</span><span class="nl">"status"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"success"</span><span class="w">
|
||||
</span><span class="p">}</span><span class="w">
|
||||
</span></code></pre></div><h2 id='04cb758654'>获取用户贡献度</h2>
|
||||
<p>获取用户贡献度</p>
|
||||
|
||||
<blockquote>
|
||||
|
@ -660,9 +894,9 @@ Success — a happy kitten is an authenticated kitten!
|
|||
</blockquote>
|
||||
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> GET http://localhost:3000/api/users/yystopf/headmaps.json
|
||||
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/users/:login/headmaps.json</span><span class="dl">'</span><span class="p">)</span>
|
||||
</code></pre></div><h3 id='http-2'>HTTP 请求</h3>
|
||||
</code></pre></div><h3 id='http-4'>HTTP 请求</h3>
|
||||
<p><code>GET api/users/:login/headmaps.json</code></p>
|
||||
<h3 id='7447e4874e-2'>返回字段说明:</h3>
|
||||
<h3 id='7447e4874e-3'>返回字段说明:</h3>
|
||||
<table><thead>
|
||||
<tr>
|
||||
<th>参数</th>
|
||||
|
@ -791,9 +1025,9 @@ Success — a happy kitten is an authenticated kitten!
|
|||
</blockquote>
|
||||
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> GET http://localhost:3000/api/users/yystopf/applied_messages.json
|
||||
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/users/:login/applied_messages.json</span><span class="dl">'</span><span class="p">)</span>
|
||||
</code></pre></div><h3 id='http-3'>HTTP 请求</h3>
|
||||
</code></pre></div><h3 id='http-5'>HTTP 请求</h3>
|
||||
<p><code>GET /api/users/:login/applied_messages.json</code></p>
|
||||
<h3 id='aa883f5d52'>请求字段说明:</h3>
|
||||
<h3 id='aa883f5d52-2'>请求字段说明:</h3>
|
||||
<table><thead>
|
||||
<tr>
|
||||
<th>参数</th>
|
||||
|
@ -807,7 +1041,7 @@ Success — a happy kitten is an authenticated kitten!
|
|||
<td>用户标识</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
<h3 id='7447e4874e-3'>返回字段说明:</h3>
|
||||
<h3 id='7447e4874e-4'>返回字段说明:</h3>
|
||||
<table><thead>
|
||||
<tr>
|
||||
<th>参数</th>
|
||||
|
@ -1028,9 +1262,9 @@ Success — a happy kitten is an authenticated kitten!
|
|||
</blockquote>
|
||||
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> GET http://localhost:3000/api/users/yystopf/applied_transfer_projects.json
|
||||
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/users/:login/applied_transfer_projects.json</span><span class="dl">'</span><span class="p">)</span>
|
||||
</code></pre></div><h3 id='http-4'>HTTP 请求</h3>
|
||||
</code></pre></div><h3 id='http-6'>HTTP 请求</h3>
|
||||
<p><code>GET /api/users/:login/applied_transfer_projects.json</code></p>
|
||||
<h3 id='aa883f5d52-2'>请求字段说明:</h3>
|
||||
<h3 id='aa883f5d52-3'>请求字段说明:</h3>
|
||||
<table><thead>
|
||||
<tr>
|
||||
<th>参数</th>
|
||||
|
@ -1044,7 +1278,7 @@ Success — a happy kitten is an authenticated kitten!
|
|||
<td>用户标识</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
<h3 id='7447e4874e-4'>返回字段说明:</h3>
|
||||
<h3 id='7447e4874e-5'>返回字段说明:</h3>
|
||||
<table><thead>
|
||||
<tr>
|
||||
<th>参数</th>
|
||||
|
@ -1220,9 +1454,9 @@ Success — a happy kitten is an authenticated kitten!
|
|||
</blockquote>
|
||||
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> POST http://localhost:3000/api/users/yystopf/applied_transfer_projects/2/accept.json
|
||||
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/users/:login/applied_transfer_projects/:id/accept.json</span><span class="dl">'</span><span class="p">)</span>
|
||||
</code></pre></div><h3 id='http-5'>HTTP 请求</h3>
|
||||
</code></pre></div><h3 id='http-7'>HTTP 请求</h3>
|
||||
<p><code>GET /api/users/:login/applied_transfer_projects/:id/accept.json</code></p>
|
||||
<h3 id='aa883f5d52-3'>请求字段说明:</h3>
|
||||
<h3 id='aa883f5d52-4'>请求字段说明:</h3>
|
||||
<table><thead>
|
||||
<tr>
|
||||
<th>参数</th>
|
||||
|
@ -1241,7 +1475,7 @@ Success — a happy kitten is an authenticated kitten!
|
|||
<td>迁移id</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
<h3 id='7447e4874e-5'>返回字段说明:</h3>
|
||||
<h3 id='7447e4874e-6'>返回字段说明:</h3>
|
||||
<table><thead>
|
||||
<tr>
|
||||
<th>参数</th>
|
||||
|
@ -1411,9 +1645,9 @@ Success — a happy kitten is an authenticated kitten!
|
|||
</blockquote>
|
||||
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> POST http://localhost:3000/api/users/yystopf/applied_transfer_projects/2/refuse.json
|
||||
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/users/:login/applied_transfer_projects/:id/refuse.json</span><span class="dl">'</span><span class="p">)</span>
|
||||
</code></pre></div><h3 id='http-6'>HTTP 请求</h3>
|
||||
</code></pre></div><h3 id='http-8'>HTTP 请求</h3>
|
||||
<p><code>GET /api/users/:login/applied_transfer_projects/:id/refuse.json</code></p>
|
||||
<h3 id='aa883f5d52-4'>请求字段说明:</h3>
|
||||
<h3 id='aa883f5d52-5'>请求字段说明:</h3>
|
||||
<table><thead>
|
||||
<tr>
|
||||
<th>参数</th>
|
||||
|
@ -1432,7 +1666,7 @@ Success — a happy kitten is an authenticated kitten!
|
|||
<td>迁移id</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
<h3 id='7447e4874e-6'>返回字段说明:</h3>
|
||||
<h3 id='7447e4874e-7'>返回字段说明:</h3>
|
||||
<table><thead>
|
||||
<tr>
|
||||
<th>参数</th>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe PinnedProject, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in New Issue