修复:混合查询字段编码集更改以及gitea service缺失
This commit is contained in:
parent
00eda17c2c
commit
2600eacb34
|
@ -0,0 +1,40 @@
|
|||
# get the diff info for the commit
|
||||
class Gitea::Commit::DiffService < Gitea::ClientService
|
||||
attr_reader :owner, :repo, :sha, :token
|
||||
|
||||
# GET /repos/{owner}/{repo}/commits/{sha}/diff
|
||||
# owner: 用户
|
||||
# repo: 仓库名称/标识
|
||||
# sha: commit唯一标识
|
||||
# eg:
|
||||
# Gitea::Commit::DiffService.call('jasder', 'repo_identifier', 'sha value')
|
||||
def initialize(owner, repo, sha, token=nil)
|
||||
@owner = owner
|
||||
@repo = repo
|
||||
@sha = sha
|
||||
@token = token
|
||||
end
|
||||
|
||||
def call
|
||||
response = get(url, params)
|
||||
render_result(response)
|
||||
end
|
||||
|
||||
private
|
||||
def params
|
||||
Hash.new.merge(token: token)
|
||||
end
|
||||
|
||||
def url
|
||||
"/repos/#{owner}/#{repo}/commits/#{sha}/diff".freeze
|
||||
end
|
||||
|
||||
def render_result(response)
|
||||
case response.status
|
||||
when 200
|
||||
JSON.parse(response.body)
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,39 @@
|
|||
class Gitea::Commit::InfoService < Gitea::ClientService
|
||||
attr_reader :owner, :repo, :sha, :token
|
||||
|
||||
# GET /repos/{owner}/{repo}/commits/{sha}/diff
|
||||
# owner: 用户
|
||||
# repo: 仓库名称/标识
|
||||
# sha: commit唯一标识
|
||||
# eg:
|
||||
# Gitea::Commit::InfoService.call('jasder', 'repo_identifier', 'sha value', token='gitea token')
|
||||
def initialize(owner, repo, sha, token=nil)
|
||||
@owner = owner
|
||||
@repo = repo
|
||||
@sha = sha
|
||||
@token = token
|
||||
end
|
||||
|
||||
def call
|
||||
response = get(url, params)
|
||||
render_result(response)
|
||||
end
|
||||
|
||||
private
|
||||
def params
|
||||
Hash.new.merge(token: token)
|
||||
end
|
||||
|
||||
def url
|
||||
"/repos/#{owner}/#{repo}/git/commits/#{sha}".freeze
|
||||
end
|
||||
|
||||
def render_result(response)
|
||||
case response.status
|
||||
when 200
|
||||
JSON.parse(response.body)
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
class ChangeUserMixinFieldCollate < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
execute("ALTER TABLE `users` MODIFY `login` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;")
|
||||
execute("ALTER TABLE `users` MODIFY `mail` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;")
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue