mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 14:05:52 +01:00
Implemented the registration of the issue.
This commit is contained in:
@@ -9,26 +9,26 @@ import model._
|
||||
|
||||
trait IssuesService {
|
||||
def saveIssue(owner: String, repository: String, loginUser: String,
|
||||
title: String, content: String) = {
|
||||
title: String, content: Option[String]) =
|
||||
// next id number
|
||||
val id = sql"SELECT ISSUE_ID + 1 FROM ISSUE_ID WHERE USER_NAME = $owner AND REPOSITORY_NAME = $repository FOR UPDATE".as[Int].first
|
||||
sql"SELECT ISSUE_ID + 1 FROM ISSUE_ID WHERE USER_NAME = $owner AND REPOSITORY_NAME = $repository FOR UPDATE".as[Int]
|
||||
.firstOption.filter { id =>
|
||||
Issues insert Issue(
|
||||
owner,
|
||||
repository,
|
||||
id,
|
||||
loginUser,
|
||||
None,
|
||||
None,
|
||||
title,
|
||||
content,
|
||||
new java.sql.Date(System.currentTimeMillis), // TODO
|
||||
new java.sql.Date(System.currentTimeMillis))
|
||||
|
||||
Issues insert Issue(
|
||||
owner,
|
||||
repository,
|
||||
id,
|
||||
loginUser,
|
||||
None,
|
||||
None,
|
||||
title,
|
||||
content,
|
||||
new java.sql.Date(System.currentTimeMillis), // TODO
|
||||
new java.sql.Date(System.currentTimeMillis))
|
||||
|
||||
// increment id
|
||||
IssueId filter { t =>
|
||||
(t.userName is owner.bind) && (t.repositoryName is repository.bind)
|
||||
} map (_.issueId) update(id)
|
||||
}
|
||||
// increment issue id
|
||||
IssueId.filter { t =>
|
||||
(t.userName is owner.bind) && (t.repositoryName is repository.bind)
|
||||
}.map(_.issueId).update(id) > 0
|
||||
} get
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user