Newer
Older
bremer / src / main / kotlin / entity / Audio.kt
yhornisse on 9 Jul 2023 1 KB fix tables
/*
 * Copyright (c) 2023. yo-saito. All Rights Reserved.
 */

package net.piedpiper.bremer.entity

import net.piedpiper.bremer.utils.sql.Column
import net.piedpiper.bremer.utils.sql.Table
import java.time.LocalDateTime

@Table("audio")
data class AudioEntity(
    @property:Column("id", insertable = false, updatable = false)
    var id: Long = 0L,
    @property:Column("slug")
    var slug: String = "",
    @property:Column("name")
    var name: String = "",
    @property:Column("album_id")
    var albumId: Long = 0L,
    @property:Column("path")
    var path: String = "",
    // join
    var album: AlbumEntity? = null
)

@Table("album")
data class AlbumEntity(
    @property:Column("id", insertable = false, updatable = false)
    var id: Long = 0L,
    @property:Column("artist_id")
    var artistId: Long = 0L,
    @property:Column("name")
    var name: String = "",
    // join
    var artist: ArtistEntity? = null
)

@Table("artist")
data class ArtistEntity(
    @property:Column("id", insertable = false, updatable = false)
    var id: Long = 0L,
    @property:Column("name")
    var name: String = "",
)

@Table("audio_play_history")
data class AudioPlayHistoryEntity(
    @property:Column("id", insertable = false, updatable = false)
    var id: Long = 0L,
    @property:Column("audio_id")
    var audioId: Long = 0L,
    @property:Column("last_played_at")
    var lastPlayedAt: LocalDateTime = LocalDateTime.MIN
)