Add SongEvent #9
+4
-11
@@ -1,24 +1,17 @@
|
|||||||
|
|
||||||
pub struct SongEvent {
|
pub struct SongEvent {
|
||||||
pub id: uuid::Uuid,
|
pub id: uuid::Uuid,
|
||||||
pub song_id: uuid::Uuid,
|
pub song_id: uuid::Uuid,
|
||||||
pub user_id: uuid::Uuid,
|
pub user_id: uuid::Uuid,
|
||||||
pub event_type: String,
|
pub event_type: String,
|
||||||
pub event_time: time::OffsetDateTime
|
pub event_time: time::OffsetDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SongEvent {
|
impl SongEvent {
|
||||||
pub fn is_event_type_valid(&self) -> bool {
|
pub fn is_event_type_valid(&self) -> bool {
|
||||||
match self.event_type.as_str() {
|
match self.event_type.as_str() {
|
||||||
SONG_EVENT_TYPE_PLAY => {
|
SONG_EVENT_TYPE_PLAY => true,
|
||||||
true
|
SONG_EVENT_TYPE_PAUSE => true,
|
||||||
},
|
_ => false,
|
||||||
SONG_EVENT_TYPE_PAUSE => {
|
|
||||||
true
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user