Skip to content

Commit

Permalink
core: Init realm models
Browse files Browse the repository at this point in the history
  • Loading branch information
sirambd committed Jul 2, 2024
1 parent 71c8682 commit c8b1fa1
Show file tree
Hide file tree
Showing 5 changed files with 176 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Infomaniak SwissTransfer - Multiplatform
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.infomaniak.multiplatform_swisstransfer.db.models

import com.infomaniak.multiplatform_swisstransfer.common.interfaces.Container
import io.realm.kotlin.ext.realmListOf
import io.realm.kotlin.types.RealmList
import io.realm.kotlin.types.RealmObject
import io.realm.kotlin.types.annotations.PrimaryKey

class ContainerDB : Container<RealmList<FileDB>>, RealmObject {
@PrimaryKey
override var uuid: String = ""
override var duration: Long = 0
override var createdDateTimestamp: Long = 0
override var expiredDateTimestamp: Long = 0
override var numberOfFile: Long = 0
override var message: String? = ""
override var needPassword: Long = 0 // TODO: Boolean ?
override var lang: String = ""
override var sizeUploaded: Long = 0
override var deletedDateTimestamp: Long? = null
override var swiftVersion: Long = 0
override var downloadLimit: Long = 0
override var source: String = ""

// @SerialName("WSUser") TODO: What's it ?
//val wsUser: JsonElement?

override var files: RealmList<FileDB> = realmListOf()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Infomaniak SwissTransfer - Multiplatform
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.infomaniak.multiplatform_swisstransfer.db.models

import com.infomaniak.multiplatform_swisstransfer.common.interfaces.File
import io.realm.kotlin.types.RealmObject
import io.realm.kotlin.types.annotations.PrimaryKey

class FileDB : File, RealmObject {
@PrimaryKey
override var containerUUID: String = ""
override var uuid: String = ""
override var fileName: String = ""
override var fileSizeInBytes: Long = 0
override var downloadCounter: Long = 0
override var createdDateTimestamp: Long = 0
override var expiredDateTimestamp: Long = 0
override var eVirus: String = ""
override var deletedDate: String? = null
override var mimeType: String = ""
override var receivedSizeInBytes: Long = 0
override var path: String? = ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Infomaniak SwissTransfer - Multiplatform
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.infomaniak.multiplatform_swisstransfer.db.models

import com.infomaniak.multiplatform_swisstransfer.common.interfaces.Transfer
import io.realm.kotlin.types.RealmObject
import io.realm.kotlin.types.annotations.PrimaryKey

class TransferDB : Transfer<ContainerDB>, RealmObject {
@PrimaryKey
override var linkUUID: String = ""
override var containerUUID: String = ""
override var downloadCounterCredit: Long = 0
override var createdDateTimestamp: Long = 0
override var expiredDateTimestamp: Long = 0
override var isDownloadOnetime: Long = 0 // TODO: Boolean ?
override var isMailSent: Boolean = false
override var downloadHost: String = ""
override var container: ContainerDB = ContainerDB()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Infomaniak SwissTransfer - Multiplatform
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.infomaniak.multiplatform_swisstransfer.db.models.setting

import io.realm.kotlin.types.RealmObject

class AppSettings : RealmObject {
//TODO: implement here
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Infomaniak SwissTransfer - Multiplatform
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.infomaniak.multiplatform_swisstransfer.db.models.upload

import io.realm.kotlin.types.RealmObject

/**
* Class representing files to be uploaded
*/
class UploadTasks : RealmObject {
var userId: Long = 0
//TODO: implement
}

0 comments on commit c8b1fa1

Please sign in to comment.