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