Fixes a spelling mistake I made in the database schema 😬

Release Notes:

- n/a
This commit is contained in:
Mikayla Maki 2024-01-11 10:57:08 -08:00 committed by GitHub
commit e3c9c602f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 12 deletions

View file

@ -1180,7 +1180,7 @@ impl Database {
.await?;
let room_id = if let Some(room) = room {
if let Some(env) = room.enviroment {
if let Some(env) = room.environment {
if &env != environment {
Err(anyhow!("must join using the {} release", env))?;
}
@ -1190,7 +1190,7 @@ impl Database {
let result = room::Entity::insert(room::ActiveModel {
channel_id: ActiveValue::Set(Some(channel_id)),
live_kit_room: ActiveValue::Set(live_kit_room.to_string()),
enviroment: ActiveValue::Set(Some(environment.to_string())),
environment: ActiveValue::Set(Some(environment.to_string())),
..Default::default()
})
.exec(&*tx)

View file

@ -112,7 +112,7 @@ impl Database {
self.transaction(|tx| async move {
let room = room::ActiveModel {
live_kit_room: ActiveValue::set(live_kit_room.into()),
enviroment: ActiveValue::set(Some(release_channel.to_string())),
environment: ActiveValue::set(Some(release_channel.to_string())),
..Default::default()
}
.insert(&*tx)
@ -299,28 +299,28 @@ impl Database {
room_id: RoomId,
user_id: UserId,
connection: ConnectionId,
enviroment: &str,
environment: &str,
) -> Result<RoomGuard<JoinRoom>> {
self.room_transaction(room_id, |tx| async move {
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
enum QueryChannelIdAndEnviroment {
enum QueryChannelIdAndEnvironment {
ChannelId,
Enviroment,
Environment,
}
let (channel_id, release_channel): (Option<ChannelId>, Option<String>) =
room::Entity::find()
.select_only()
.column(room::Column::ChannelId)
.column(room::Column::Enviroment)
.column(room::Column::Environment)
.filter(room::Column::Id.eq(room_id))
.into_values::<_, QueryChannelIdAndEnviroment>()
.into_values::<_, QueryChannelIdAndEnvironment>()
.one(&*tx)
.await?
.ok_or_else(|| anyhow!("no such room"))?;
if let Some(release_channel) = release_channel {
if &release_channel != enviroment {
if &release_channel != environment {
Err(anyhow!("must join using the {} release", release_channel))?;
}
}

View file

@ -8,7 +8,7 @@ pub struct Model {
pub id: RoomId,
pub live_kit_room: String,
pub channel_id: Option<ChannelId>,
pub enviroment: Option<String>,
pub environment: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]