Go back to a compiling state, panicking on unimplemented db methods
This commit is contained in:
parent
d2385bd6a0
commit
db1d93576f
4 changed files with 1240 additions and 51 deletions
File diff suppressed because it is too large
Load diff
|
@ -13,6 +13,12 @@ pub struct Model {
|
|||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::user::Entity",
|
||||
from = "Column::HostUserId",
|
||||
to = "super::user::Column::Id"
|
||||
)]
|
||||
HostUser,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::room::Entity",
|
||||
from = "Column::RoomId",
|
||||
|
@ -23,6 +29,12 @@ pub enum Relation {
|
|||
Worktree,
|
||||
}
|
||||
|
||||
impl Related<super::user::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::HostUser.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::room::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Room.def()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use super::{ProjectCollaboratorId, ProjectId, UserId};
|
||||
use super::{ProjectCollaboratorId, ProjectId, ReplicaId, UserId};
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
|
||||
|
@ -9,7 +9,7 @@ pub struct Model {
|
|||
pub project_id: ProjectId,
|
||||
pub connection_id: i32,
|
||||
pub user_id: UserId,
|
||||
pub replica_id: i32,
|
||||
pub replica_id: ReplicaId,
|
||||
pub is_host: bool,
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ pub enum Relation {
|
|||
AccessToken,
|
||||
#[sea_orm(has_one = "super::room_participant::Entity")]
|
||||
RoomParticipant,
|
||||
#[sea_orm(has_many = "super::project::Entity")]
|
||||
HostedProjects,
|
||||
}
|
||||
|
||||
impl Related<super::access_token::Entity> for Entity {
|
||||
|
@ -38,4 +40,10 @@ impl Related<super::room_participant::Entity> for Entity {
|
|||
}
|
||||
}
|
||||
|
||||
impl Related<super::project::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::HostedProjects.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue