mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 22:45:51 +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?
|
// TODO create a git repository also here?
|
||||||
|
|
||||||
val currentDate = new java.sql.Date(System.currentTimeMillis)
|
val currentDate = new java.sql.Date(System.currentTimeMillis)
|
||||||
|
|
||||||
Projects.ins returning Projects.projectId insert
|
Projects.ins returning Projects.projectId insert
|
||||||
Project(
|
Project(
|
||||||
projectId = None,
|
projectId = None,
|
||||||
projectName = projectName,
|
projectName = projectName,
|
||||||
userId = getAccountByUserName(userName).get.userId.get,
|
userId = getUserId(userName),
|
||||||
projectType = 0 /* 0:public, 1:private */,
|
projectType = 0 /* 0:public, 1:private */,
|
||||||
description = description,
|
description = description,
|
||||||
defaultBranch = "master",
|
defaultBranch = "master",
|
||||||
@@ -34,4 +35,16 @@ trait ProjectService { self: AccountService =>
|
|||||||
lastActivityDate = currentDate)
|
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