mirror of
https://github.com/smyalygames/checklist-tester.git
synced 2025-11-30 01:39:38 +01:00
feat(connector): create a database transaction class for Project
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
package io.anthonyberg.connector.shared
|
||||||
|
|
||||||
|
import io.anthonyberg.connector.shared.database.DriverFactory
|
||||||
|
import io.anthonyberg.connector.shared.database.ProjectDatabase
|
||||||
|
import io.anthonyberg.connector.shared.entity.Project
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All database transactions for Project
|
||||||
|
*/
|
||||||
|
class ProjectTransaction (driverFactory: DriverFactory) {
|
||||||
|
private val database = ProjectDatabase(driverFactory)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all Projects in the database.
|
||||||
|
*/
|
||||||
|
fun getProjects(): List<Project> {
|
||||||
|
val projects = database.getAllProjects()
|
||||||
|
return projects
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a project in the database.
|
||||||
|
*/
|
||||||
|
fun createProject(project: Project) {
|
||||||
|
database.createProject(project)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user