feat(connector): link projects to database

This commit is contained in:
Anthony
2024-04-04 18:27:32 +02:00
parent 0215ba1ef4
commit 4e040516db
6 changed files with 76 additions and 47 deletions

View File

@@ -3,6 +3,7 @@ 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
import kotlinx.datetime.Clock
/**
* All database transactions for Project
@@ -13,8 +14,10 @@ class ProjectTransaction (driverFactory: DriverFactory) {
/**
* Creates a project in the database.
*/
fun createProject(project: Project) {
database.createProject(project)
fun createProject(projectName: String, aircraftType: String) {
val currentTime = Clock.System.now().toString()
database.createProject(name = projectName, aircraftType = aircraftType, createdUTC = currentTime)
}
/**

View File

@@ -32,11 +32,11 @@ internal class ProjectDatabase (driverFactory: DriverFactory) {
/**
* Inserts a project into the database
*/
internal fun createProject(project: Project) {
internal fun createProject(name: String, aircraftType: String, createdUTC: String) {
dbQuery.createProject(
name = project.name,
aircraftType = project.aircraftType,
createdUTC = project.createdUTC,
name = name,
aircraftType = aircraftType,
createdUTC = createdUTC,
)
}