Updating name (#253)
soaricarus_api CI / Check (push) Successful in 3m21s
soaricarus_api CI / Test Suite (push) Successful in 4m25s
soaricarus_api CI / Rustfmt (push) Successful in 3m8s
soaricarus_api CI / Clippy (push) Successful in 3m56s
soaricarus_api CI / build (push) Successful in 3m3s

Reviewed-on: #253
This commit was merged in pull request #253.
This commit is contained in:
2026-07-21 15:28:48 -04:00
parent 8a64a71339
commit 59a7e31641
20 changed files with 327 additions and 364 deletions
+7 -7
View File
@@ -2,7 +2,7 @@ use sqlx::Row;
pub async fn create(
pool: &sqlx::PgPool,
coverart: &icarus_models::coverart::CoverArt,
coverart: &simodels::coverart::CoverArt,
song_id: &uuid::Uuid,
) -> Result<uuid::Uuid, sqlx::Error> {
let result = sqlx::query(
@@ -36,7 +36,7 @@ pub async fn create(
pub async fn get_coverart(
pool: &sqlx::PgPool,
id: &uuid::Uuid,
) -> Result<icarus_models::coverart::CoverArt, sqlx::Error> {
) -> Result<simodels::coverart::CoverArt, sqlx::Error> {
let result = sqlx::query(
r#"
SELECT id, title, directory, filename, file_type, song_id FROM "coverart" WHERE id = $1;
@@ -50,7 +50,7 @@ pub async fn get_coverart(
});
match result {
Ok(row) => Ok(icarus_models::coverart::CoverArt {
Ok(row) => Ok(simodels::coverart::CoverArt {
id: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
@@ -84,7 +84,7 @@ pub async fn get_coverart(
pub async fn get_coverart_with_song_id(
pool: &sqlx::PgPool,
song_id: &uuid::Uuid,
) -> Result<icarus_models::coverart::CoverArt, sqlx::Error> {
) -> Result<simodels::coverart::CoverArt, sqlx::Error> {
let result = sqlx::query(
r#"
SELECT id, title, directory, filename, file_type, song_id FROM "coverart" WHERE song_id = $1;
@@ -98,7 +98,7 @@ pub async fn get_coverart_with_song_id(
});
match result {
Ok(row) => Ok(icarus_models::coverart::CoverArt {
Ok(row) => Ok(simodels::coverart::CoverArt {
id: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
@@ -132,7 +132,7 @@ pub async fn get_coverart_with_song_id(
pub async fn delete_coverart(
pool: &sqlx::PgPool,
id: &uuid::Uuid,
) -> Result<icarus_models::coverart::CoverArt, sqlx::Error> {
) -> Result<simodels::coverart::CoverArt, sqlx::Error> {
let result = sqlx::query(
r#"
DELETE FROM "coverart"
@@ -148,7 +148,7 @@ pub async fn delete_coverart(
});
match result {
Ok(row) => Ok(icarus_models::coverart::CoverArt {
Ok(row) => Ok(simodels::coverart::CoverArt {
id: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
+9 -11
View File
@@ -2,7 +2,7 @@ use sqlx::Row;
pub async fn insert(
pool: &sqlx::PgPool,
song: &icarus_models::song::Song,
song: &simodels::song::Song,
) -> Result<(time::OffsetDateTime, uuid::Uuid), sqlx::Error> {
let result = sqlx::query(
r#"
@@ -52,7 +52,7 @@ pub async fn insert(
pub async fn get_song(
pool: &sqlx::PgPool,
id: &uuid::Uuid,
) -> Result<icarus_models::song::Song, sqlx::Error> {
) -> Result<simodels::song::Song, sqlx::Error> {
let result = sqlx::query(
r#"
SELECT * FROM "song" WHERE id = $1
@@ -72,7 +72,7 @@ pub async fn get_song(
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap();
Ok(icarus_models::song::Song {
Ok(simodels::song::Song {
id: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
@@ -145,9 +145,7 @@ pub async fn get_song(
}
}
pub async fn get_all_songs(
pool: &sqlx::PgPool,
) -> Result<Vec<icarus_models::song::Song>, sqlx::Error> {
pub async fn get_all_songs(pool: &sqlx::PgPool) -> Result<Vec<simodels::song::Song>, sqlx::Error> {
let result = sqlx::query(
r#"
SELECT * FROM "song";
@@ -161,7 +159,7 @@ pub async fn get_all_songs(
match result {
Ok(rows) => {
let mut songs: Vec<icarus_models::song::Song> = Vec::new();
let mut songs: Vec<simodels::song::Song> = Vec::new();
for row in rows {
let date_created_time: time::OffsetDateTime = row
@@ -169,7 +167,7 @@ pub async fn get_all_songs(
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap();
let song = icarus_models::song::Song {
let song = simodels::song::Song {
id: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)
@@ -250,9 +248,9 @@ pub async fn get_all_songs(
pub async fn delete_song(
pool: &sqlx::PgPool,
id: &uuid::Uuid,
) -> Result<icarus_models::song::Song, sqlx::Error> {
) -> Result<simodels::song::Song, sqlx::Error> {
let result = sqlx::query(
// icarus_models::song::Song,
// simodels::song::Song,
r#"
DELETE FROM "song"
WHERE id = $1
@@ -273,7 +271,7 @@ pub async fn delete_song(
.map_err(|_e| sqlx::Error::RowNotFound)
.unwrap();
Ok(icarus_models::song::Song {
Ok(simodels::song::Song {
id: row
.try_get("id")
.map_err(|_e| sqlx::Error::RowNotFound)