Newer
Older
bremer / src / main / kotlin / entity / Audio.kt
yhornisse on 22 Jul 2023 1 KB add alias_name
/*
 * 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,
    var aliasNames: List<AudioNameEntity>? = null
)

@Table("audio_name")
data class AudioNameEntity(
    @property:Column("id", insertable = false, updatable = false)
    var id: Long = 0L,
    @property:Column("audio_id")
    var audioId: Long = 0L,
    @property:Column("name")
    var name: String = ""
)

@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
)