feat: add basic HTTP, websocket functionality
- add ntex and serde as requirements - add HTTP server with index/ and ws/ endpoints - add websocket types and systems, basic Ping and GetTracks endpoints - add serialize/deserialize support to models::Tracks - add handle and get_tracks method to library - clean up types.rs
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use diesel::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::schema::{artists, collections, tracks};
|
||||
|
||||
@@ -22,7 +23,10 @@ pub struct Collection {
|
||||
pub display_name: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Queryable, Selectable, Identifiable, Associations)]
|
||||
// TODO: make this more ergonomic (nested artist object instead of artist ID, etc)
|
||||
#[derive(
|
||||
Debug, Clone, Queryable, Selectable, Identifiable, Associations, Serialize, Deserialize,
|
||||
)]
|
||||
#[diesel(table_name = tracks)]
|
||||
#[diesel(belongs_to(Artist, foreign_key = artist_id))]
|
||||
#[diesel(belongs_to(Collection, foreign_key = collection_id))]
|
||||
@@ -68,4 +72,4 @@ pub struct NewTrack<'a> {
|
||||
pub genre: Option<&'a str>,
|
||||
pub track_datetime: Option<&'a str>,
|
||||
pub length_sec: i32,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user