A mobile app for listening to radio stations from around the globe
git clone git://soophie.de/verbal
72
if(this.group === null) {73
return false;74
}75
return this.group.filter((station) => this.station.id !== station.id).length > 0;75
return this.group.stations.filter((station) => this.station.id !== station.id).length > 0;76
},77
getDescription() {78
return this.station.description ?? this.group?.group.description;79
}80
},81
created() {
134
>135
<p136
:title="station.name"134
class="text-[24px] font-[600] text-gray-100 pb-0 overflow-hidden text-ellipsis whitespace-nowrap"137
class="text-[24px] md:text-[36px] font-[600] text-gray-100 pb-0 overflow-hidden text-ellipsis whitespace-nowrap"138
>139
{{station.name}}140
</p>
187
:text="$lang(station.is_favorite ? 'global.unlike' : 'global.like')"188
></v-button>189
</div>187
<p v-if="station.description" class="text-md text-gray-400" v-html="station.description"></p>190
<p v-if="getDescription()" class="text-md text-gray-400" v-html="getDescription()"></p>191
<p v-else class="text-md text-gray-400">{{$lang('detail.no-description')}}</p>192
<div v-if="station.is_restricted || station.is_broken || station.is_no_track_info" class="flex gap-2 flex-wrap">193
<span
214
<ul class="flex flex-col">215
<li216
:key="station.id"214
v-for="group_station in group"217
v-for="group_station in group.stations"218
v-if="station.id !== group_station.id"219
class="border-t sm:border-t-2 first:border-none border-zinc-900 py-4 first:pt-0"220
>
25
VImage26
},27
watch: {28
station(value) {28
station(value, old) {29
if(value?.id === old?.id) {30
return;31
}32
this.playing = false;33
this.error = false;34
if(value !== null) {
31
CREATE TABLE station_group (32
id SERIAL PRIMARY KEY,33
name TEXT NOT NULL33
name TEXT NOT NULL,34
description TEXT35
);37
/* ############################################################ */
58
pub group_id: Option<i32>,59
}61
#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]62
pub struct StationGroup {63
pub id: i32,64
pub name: String,65
pub description: Option<String>,66
}68
#[derive(Debug, Serialize, Deserialize, FromRow)]69
pub struct Favorite {70
pub id: i32,
1
use async_std::io::ReadExt;2
use regex::Regex;3
use serde::Serialize;4
use sqlx::Acquire;5
use sqlx::Postgres;6
use tide_sqlx::SQLxRequestExt;
277
let group_id = unwrap_result_or_throw!(req.param("id"), "no group id found!");278
let account =279
unwrap_option_or_throw!(req.ext::<model::Account>(), "no account in request found!");280
let mut conn = req.sqlx_conn::<Postgres>().await;281
let sql = format!(282
r#"283
SELECT284
station_group.*285
FROM station_group286
WHERE station_group.id = {group_id}287
"#,288
group_id = group_id,289
);290
let group = unwrap_option_or_throw!(291
sqlx::query_as::<_, model::StationGroup>(&sql)292
.fetch_optional(conn.acquire().await?)293
.await?,294
"no group with id found!"295
);296
let sql = format!(297
r#"298
SELECT
322
account_id = account.id,323
group_id = group_id,324
);308
let mut conn = req.sqlx_conn::<Postgres>().await;309
let result = sqlx::query_as::<_, model::Station>(&sql)325
let stations = sqlx::query_as::<_, model::Station>(&sql)326
.fetch_all(conn.acquire().await?)327
.await?;328
#[derive(Serialize)]329
struct Result {330
group: model::StationGroup,331
stations: Vec<model::Station>,332
}333
let result = Result { group, stations };334
Response::with(result)335
}