mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 14:35:52 +01:00
Insert project info into database before actual git repository creation.
This commit is contained in:
@@ -21,11 +21,12 @@ trait ProjectService { self: AccountService =>
|
||||
// TODO create a git repository also here?
|
||||
|
||||
val currentDate = new java.sql.Date(System.currentTimeMillis)
|
||||
|
||||
Projects.ins returning Projects.projectId insert
|
||||
Project(
|
||||
projectId = None,
|
||||
projectName = projectName,
|
||||
userId = getAccountByUserName(userName).get.userId.get,
|
||||
userId = getUserId(userName),
|
||||
projectType = 0 /* 0:public, 1:private */,
|
||||
description = description,
|
||||
defaultBranch = "master",
|
||||
@@ -34,4 +35,16 @@ trait ProjectService { self: AccountService =>
|
||||
lastActivityDate = currentDate)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the specified user's project list.
|
||||
*
|
||||
* @param userName the user name
|
||||
* @return the project list which is sorted in descending order of lastActivityDate.
|
||||
*/
|
||||
def getProjects(userName: String): List[Project] = {
|
||||
Query(Projects) filter(_.userId is getUserId(userName).bind) sortBy(_.lastActivityDate desc) list
|
||||
}
|
||||
|
||||
private def getUserId(userName: String): Long = getAccountByUserName(userName).get.userId.get
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user