Skip to content

Commit

Permalink
fix: audio files put metadata (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiroaisen authored Nov 25, 2023
2 parents 7f4a368 + 3e16dcb commit 968bc5a
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { invalidate } from "$app/navigation";
import Page from "$lib/components/Page.svelte";
import { ripple } from "$share/ripple";
import { action, ClientError, _delete, _get, _post, _put, _request } from "$share/net.client";
import { action, ClientError, _delete, _get, _post, _put, _request, _patch } from "$share/net.client";
import { mdiPlay, mdiPause, mdiAlertDecagram, mdiCheck, mdiTimerPauseOutline, mdiCircleEditOutline, mdiTrashCanOutline, mdiAutorenew, mdiCheckboxIntermediate, mdiCheckboxBlankOutline, mdiContentSaveOutline, mdiDrag, mdiMusic, mdiShuffleVariant, mdiShuffleDisabled, mdiRestart } from "@mdi/js";
import Icon from "$share/Icon.svelte";
import { onMount } from "svelte";
Expand Down Expand Up @@ -484,7 +484,7 @@
const edit_save = action(async () => {
if(audio_item_to_edit == null) return;
const payload: import("$api/stations/[station]/files/[file]/metadata/PATCH/Payload").Payload = {
const payload: import("$api/stations/[station]/files/[file]/metadata/PUT/Payload").Payload = {
title: edit_current_title.trim() || null,
artist: edit_current_artist.trim() || null,
album: edit_current_album.trim() || null,
Expand Down
3 changes: 2 additions & 1 deletion front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"ci:share": "cd share && npm ci",
"ci:server": "cd server && npm ci",
"ci:admin": "cd admin && npm ci",
"ci:app": "cd app && npm ci"
"ci:app": "cd app && npm ci",
"start": "cd server && npm run start"
},
"keywords": [],
"author": "",
Expand Down
2 changes: 1 addition & 1 deletion front/server/src/api/shared-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export const shared_api = ({

api.route("/stations/:station/files/:file/metadata")
.put(json(async req => {
return await client.stations.files.patch_metadata(ip(req), ua(req), get_token(req), req.params.station, req.params.file, req.body);
return await client.stations.files.put_metadata(ip(req), ua(req), get_token(req), req.params.station, req.params.file, req.body);
}))

api.route("/stations/:station/now-playing")
Expand Down
4 changes: 2 additions & 2 deletions front/server/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,8 @@ export class StationFiles {
return await this.client.get_json_body(res)
}

async patch_metadata(ip: string | null, ua: string | null, token: string, station_id: string, file_id: string, payload: import("$api/stations/[station]/files/[file]/metadata/PATCH/Payload").Payload): Promise<import("$api/stations/[station]/files/[file]/metadata/PATCH/Output").Output> {
return await this.client.patch(ip, ua, token, `/stations/${station_id}/files/${file_id}/metadata`, payload);
async put_metadata(ip: string | null, ua: string | null, token: string, station_id: string, file_id: string, payload: import("$api/stations/[station]/files/[file]/metadata/PUT/Payload").Payload): Promise<import("$api/stations/[station]/files/[file]/metadata/PUT/Output").Output> {
return await this.client.put(ip, ua, token, `/stations/${station_id}/files/${file_id}/metadata`, payload);
}

async shuffle(ip: string | null, ua: string | null, token: string, station_id: string): Promise<import("$api/stations/[station]/files/suffle/POST/Output").Output> {
Expand Down
2 changes: 1 addition & 1 deletion rs/packages/api/src/routes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ pub fn router(

app
.at("/stations/:station/files/:file/metadata")
.put(stations::files::metadata::patch::Endpoint {}.into_handler());
.put(stations::files::metadata::put::Endpoint {}.into_handler());

app
.at("/stations/:station/files/:file/order/swap")
Expand Down
6 changes: 3 additions & 3 deletions rs/packages/api/src/routes/stations/files/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use mongodb::bson::doc;
use prex::Request;
use serde::{Deserialize, Serialize};

pub mod patch {
pub mod put {

use db::run_transaction;
use prex::request::ReadBodyJsonError;
Expand All @@ -23,7 +23,7 @@ pub mod patch {
#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq, Clone, TS)]
#[ts(
export,
export_to = "../../../defs/api/stations/[station]/files/[file]/metadata/PATCH/"
export_to = "../../../defs/api/stations/[station]/files/[file]/metadata/PUT/"
)]
#[serde(rename_all = "snake_case")]
pub struct Payload {
Expand Down Expand Up @@ -107,7 +107,7 @@ pub mod patch {
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
#[ts(
export,
export_to = "../../../defs/api/stations/[station]/files/[file]/metadata/PATCH/"
export_to = "../../../defs/api/stations/[station]/files/[file]/metadata/PUT/"
)]
#[serde(rename_all = "snake_case")]
pub struct Output {
Expand Down

0 comments on commit 968bc5a

Please sign in to comment.