mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
add open workspace handler
This commit is contained in:
@ -4,32 +4,34 @@ use std::convert::TryInto;
|
||||
|
||||
#[derive(Default, ProtoBuf)]
|
||||
pub struct QueryWorkspaceRequest {
|
||||
#[pb(index = 1)]
|
||||
pub workspace_id: String,
|
||||
#[pb(index = 1, one_of)]
|
||||
pub workspace_id: Option<String>,
|
||||
|
||||
#[pb(index = 2)]
|
||||
pub read_apps: bool,
|
||||
pub user_id: String,
|
||||
}
|
||||
|
||||
// Read all workspaces if the workspace_id is None
|
||||
#[derive(ProtoBuf, Default)]
|
||||
pub struct QueryWorkspaceParams {
|
||||
#[pb(index = 1)]
|
||||
pub workspace_id: String,
|
||||
#[pb(index = 1, one_of)]
|
||||
pub workspace_id: Option<String>,
|
||||
|
||||
#[pb(index = 2)]
|
||||
pub read_apps: bool,
|
||||
pub user_id: String,
|
||||
}
|
||||
|
||||
impl QueryWorkspaceParams {
|
||||
pub fn new(workspace_id: &str) -> Self {
|
||||
pub fn new(user_id: &str) -> Self {
|
||||
Self {
|
||||
workspace_id: workspace_id.to_owned(),
|
||||
workspace_id: None,
|
||||
user_id: user_id.to_owned(),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn read_apps(mut self) -> Self {
|
||||
self.read_apps = true;
|
||||
pub fn workspace_id(mut self, workspace_id: &str) -> Self {
|
||||
self.workspace_id = Some(workspace_id.to_string());
|
||||
self
|
||||
}
|
||||
}
|
||||
@ -38,17 +40,22 @@ impl TryInto<QueryWorkspaceParams> for QueryWorkspaceRequest {
|
||||
type Error = WorkspaceError;
|
||||
|
||||
fn try_into(self) -> Result<QueryWorkspaceParams, Self::Error> {
|
||||
let workspace_id = WorkspaceId::parse(self.workspace_id)
|
||||
.map_err(|e| {
|
||||
ErrorBuilder::new(WsErrCode::WorkspaceIdInvalid)
|
||||
.msg(e)
|
||||
.build()
|
||||
})?
|
||||
.0;
|
||||
let workspace_id = match self.workspace_id {
|
||||
None => None,
|
||||
Some(workspace_id) => Some(
|
||||
WorkspaceId::parse(workspace_id)
|
||||
.map_err(|e| {
|
||||
ErrorBuilder::new(WsErrCode::WorkspaceIdInvalid)
|
||||
.msg(e)
|
||||
.build()
|
||||
})?
|
||||
.0,
|
||||
),
|
||||
};
|
||||
|
||||
Ok(QueryWorkspaceParams {
|
||||
workspace_id,
|
||||
read_apps: self.read_apps,
|
||||
user_id: self.user_id,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,5 @@ use flowy_derive::ProtoBuf;
|
||||
#[derive(ProtoBuf, Default, Debug)]
|
||||
pub struct CurrentWorkspace {
|
||||
#[pb(index = 1)]
|
||||
pub owner: String,
|
||||
|
||||
#[pb(index = 2)]
|
||||
pub workspace_id: String,
|
||||
}
|
||||
|
@ -21,9 +21,13 @@ pub enum WorkspaceEvent {
|
||||
DeleteWorkspace = 3,
|
||||
|
||||
#[display(fmt = "ReadAllWorkspace")]
|
||||
#[event(output = "Workspaces")]
|
||||
#[event(output = "RepeatedWorkspace")]
|
||||
ReadAllWorkspace = 4,
|
||||
|
||||
#[display(fmt = "OpenWorkspace")]
|
||||
#[event(input = "QueryWorkspaceRequest", output = "Workspace")]
|
||||
OpenWorkspace = 5,
|
||||
|
||||
#[display(fmt = "CreateApp")]
|
||||
#[event(input = "CreateAppRequest", output = "App")]
|
||||
CreateApp = 101,
|
||||
|
@ -29,16 +29,24 @@ pub async fn read_cur_workspace(
|
||||
pub async fn read_workspace(
|
||||
data: Data<QueryWorkspaceRequest>,
|
||||
controller: Unit<Arc<WorkspaceController>>,
|
||||
) -> DataResult<Workspace, WorkspaceError> {
|
||||
) -> DataResult<RepeatedWorkspace, WorkspaceError> {
|
||||
let params: QueryWorkspaceParams = data.into_inner().try_into()?;
|
||||
let mut workspace = controller.read_workspace(¶ms.workspace_id).await?;
|
||||
|
||||
if params.read_apps {
|
||||
let apps = controller.read_apps(¶ms.workspace_id).await?;
|
||||
workspace.apps = RepeatedApp { items: apps };
|
||||
}
|
||||
let workspaces = controller.read_workspaces(params.workspace_id).await?;
|
||||
|
||||
data_result(workspace)
|
||||
data_result(workspaces)
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "open_workspace", skip(data, controller))]
|
||||
pub async fn open_workspace(
|
||||
data: Data<QueryWorkspaceRequest>,
|
||||
controller: Unit<Arc<WorkspaceController>>,
|
||||
) -> DataResult<RepeatedWorkspace, WorkspaceError> {
|
||||
let params: QueryWorkspaceParams = data.into_inner().try_into()?;
|
||||
|
||||
let workspaces = controller.open_workspace(params.workspace_id).await?;
|
||||
|
||||
data_result(workspaces)
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "get_all_workspaces", skip(controller))]
|
||||
|
@ -47,7 +47,8 @@ pub fn create(user: Arc<dyn WorkspaceUser>, database: Arc<dyn WorkspaceDatabase>
|
||||
.event(WorkspaceEvent::ReadAllWorkspace, read_all_workspaces)
|
||||
.event(WorkspaceEvent::CreateWorkspace, create_workspace)
|
||||
.event(WorkspaceEvent::ReadCurWorkspace, read_cur_workspace)
|
||||
.event(WorkspaceEvent::ReadWorkspace, read_workspace);
|
||||
.event(WorkspaceEvent::ReadWorkspace, read_workspace)
|
||||
.event(WorkspaceEvent::OpenWorkspace, open_workspace);
|
||||
|
||||
module = module
|
||||
.event(WorkspaceEvent::CreateApp, create_app)
|
||||
|
@ -26,8 +26,9 @@
|
||||
#[derive(PartialEq,Clone,Default)]
|
||||
pub struct QueryWorkspaceRequest {
|
||||
// message fields
|
||||
pub workspace_id: ::std::string::String,
|
||||
pub read_apps: bool,
|
||||
pub user_id: ::std::string::String,
|
||||
// message oneof groups
|
||||
pub one_of_workspace_id: ::std::option::Option<QueryWorkspaceRequest_oneof_one_of_workspace_id>,
|
||||
// special fields
|
||||
pub unknown_fields: ::protobuf::UnknownFields,
|
||||
pub cached_size: ::protobuf::CachedSize,
|
||||
@ -39,6 +40,11 @@ impl<'a> ::std::default::Default for &'a QueryWorkspaceRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone,PartialEq,Debug)]
|
||||
pub enum QueryWorkspaceRequest_oneof_one_of_workspace_id {
|
||||
workspace_id(::std::string::String),
|
||||
}
|
||||
|
||||
impl QueryWorkspaceRequest {
|
||||
pub fn new() -> QueryWorkspaceRequest {
|
||||
::std::default::Default::default()
|
||||
@ -48,41 +54,75 @@ impl QueryWorkspaceRequest {
|
||||
|
||||
|
||||
pub fn get_workspace_id(&self) -> &str {
|
||||
&self.workspace_id
|
||||
match self.one_of_workspace_id {
|
||||
::std::option::Option::Some(QueryWorkspaceRequest_oneof_one_of_workspace_id::workspace_id(ref v)) => v,
|
||||
_ => "",
|
||||
}
|
||||
}
|
||||
pub fn clear_workspace_id(&mut self) {
|
||||
self.workspace_id.clear();
|
||||
self.one_of_workspace_id = ::std::option::Option::None;
|
||||
}
|
||||
|
||||
pub fn has_workspace_id(&self) -> bool {
|
||||
match self.one_of_workspace_id {
|
||||
::std::option::Option::Some(QueryWorkspaceRequest_oneof_one_of_workspace_id::workspace_id(..)) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_workspace_id(&mut self, v: ::std::string::String) {
|
||||
self.workspace_id = v;
|
||||
self.one_of_workspace_id = ::std::option::Option::Some(QueryWorkspaceRequest_oneof_one_of_workspace_id::workspace_id(v))
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_workspace_id(&mut self) -> &mut ::std::string::String {
|
||||
&mut self.workspace_id
|
||||
if let ::std::option::Option::Some(QueryWorkspaceRequest_oneof_one_of_workspace_id::workspace_id(_)) = self.one_of_workspace_id {
|
||||
} else {
|
||||
self.one_of_workspace_id = ::std::option::Option::Some(QueryWorkspaceRequest_oneof_one_of_workspace_id::workspace_id(::std::string::String::new()));
|
||||
}
|
||||
match self.one_of_workspace_id {
|
||||
::std::option::Option::Some(QueryWorkspaceRequest_oneof_one_of_workspace_id::workspace_id(ref mut v)) => v,
|
||||
_ => panic!(),
|
||||
}
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_workspace_id(&mut self) -> ::std::string::String {
|
||||
::std::mem::replace(&mut self.workspace_id, ::std::string::String::new())
|
||||
if self.has_workspace_id() {
|
||||
match self.one_of_workspace_id.take() {
|
||||
::std::option::Option::Some(QueryWorkspaceRequest_oneof_one_of_workspace_id::workspace_id(v)) => v,
|
||||
_ => panic!(),
|
||||
}
|
||||
} else {
|
||||
::std::string::String::new()
|
||||
}
|
||||
}
|
||||
|
||||
// bool read_apps = 2;
|
||||
// string user_id = 2;
|
||||
|
||||
|
||||
pub fn get_read_apps(&self) -> bool {
|
||||
self.read_apps
|
||||
pub fn get_user_id(&self) -> &str {
|
||||
&self.user_id
|
||||
}
|
||||
pub fn clear_read_apps(&mut self) {
|
||||
self.read_apps = false;
|
||||
pub fn clear_user_id(&mut self) {
|
||||
self.user_id.clear();
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_read_apps(&mut self, v: bool) {
|
||||
self.read_apps = v;
|
||||
pub fn set_user_id(&mut self, v: ::std::string::String) {
|
||||
self.user_id = v;
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_user_id(&mut self) -> &mut ::std::string::String {
|
||||
&mut self.user_id
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_user_id(&mut self) -> ::std::string::String {
|
||||
::std::mem::replace(&mut self.user_id, ::std::string::String::new())
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,14 +136,13 @@ impl ::protobuf::Message for QueryWorkspaceRequest {
|
||||
let (field_number, wire_type) = is.read_tag_unpack()?;
|
||||
match field_number {
|
||||
1 => {
|
||||
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.workspace_id)?;
|
||||
},
|
||||
2 => {
|
||||
if wire_type != ::protobuf::wire_format::WireTypeVarint {
|
||||
if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
|
||||
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
|
||||
}
|
||||
let tmp = is.read_bool()?;
|
||||
self.read_apps = tmp;
|
||||
self.one_of_workspace_id = ::std::option::Option::Some(QueryWorkspaceRequest_oneof_one_of_workspace_id::workspace_id(is.read_string()?));
|
||||
},
|
||||
2 => {
|
||||
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.user_id)?;
|
||||
},
|
||||
_ => {
|
||||
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||
@ -117,11 +156,15 @@ impl ::protobuf::Message for QueryWorkspaceRequest {
|
||||
#[allow(unused_variables)]
|
||||
fn compute_size(&self) -> u32 {
|
||||
let mut my_size = 0;
|
||||
if !self.workspace_id.is_empty() {
|
||||
my_size += ::protobuf::rt::string_size(1, &self.workspace_id);
|
||||
if !self.user_id.is_empty() {
|
||||
my_size += ::protobuf::rt::string_size(2, &self.user_id);
|
||||
}
|
||||
if self.read_apps != false {
|
||||
my_size += 2;
|
||||
if let ::std::option::Option::Some(ref v) = self.one_of_workspace_id {
|
||||
match v {
|
||||
&QueryWorkspaceRequest_oneof_one_of_workspace_id::workspace_id(ref v) => {
|
||||
my_size += ::protobuf::rt::string_size(1, &v);
|
||||
},
|
||||
};
|
||||
}
|
||||
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||
self.cached_size.set(my_size);
|
||||
@ -129,11 +172,15 @@ impl ::protobuf::Message for QueryWorkspaceRequest {
|
||||
}
|
||||
|
||||
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||
if !self.workspace_id.is_empty() {
|
||||
os.write_string(1, &self.workspace_id)?;
|
||||
if !self.user_id.is_empty() {
|
||||
os.write_string(2, &self.user_id)?;
|
||||
}
|
||||
if self.read_apps != false {
|
||||
os.write_bool(2, self.read_apps)?;
|
||||
if let ::std::option::Option::Some(ref v) = self.one_of_workspace_id {
|
||||
match v {
|
||||
&QueryWorkspaceRequest_oneof_one_of_workspace_id::workspace_id(ref v) => {
|
||||
os.write_string(1, v)?;
|
||||
},
|
||||
};
|
||||
}
|
||||
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||
::std::result::Result::Ok(())
|
||||
@ -173,15 +220,15 @@ impl ::protobuf::Message for QueryWorkspaceRequest {
|
||||
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
|
||||
descriptor.get(|| {
|
||||
let mut fields = ::std::vec::Vec::new();
|
||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||
fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>(
|
||||
"workspace_id",
|
||||
|m: &QueryWorkspaceRequest| { &m.workspace_id },
|
||||
|m: &mut QueryWorkspaceRequest| { &mut m.workspace_id },
|
||||
QueryWorkspaceRequest::has_workspace_id,
|
||||
QueryWorkspaceRequest::get_workspace_id,
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
|
||||
"read_apps",
|
||||
|m: &QueryWorkspaceRequest| { &m.read_apps },
|
||||
|m: &mut QueryWorkspaceRequest| { &mut m.read_apps },
|
||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||
"user_id",
|
||||
|m: &QueryWorkspaceRequest| { &m.user_id },
|
||||
|m: &mut QueryWorkspaceRequest| { &mut m.user_id },
|
||||
));
|
||||
::protobuf::reflect::MessageDescriptor::new_pb_name::<QueryWorkspaceRequest>(
|
||||
"QueryWorkspaceRequest",
|
||||
@ -199,8 +246,8 @@ impl ::protobuf::Message for QueryWorkspaceRequest {
|
||||
|
||||
impl ::protobuf::Clear for QueryWorkspaceRequest {
|
||||
fn clear(&mut self) {
|
||||
self.workspace_id.clear();
|
||||
self.read_apps = false;
|
||||
self.one_of_workspace_id = ::std::option::Option::None;
|
||||
self.user_id.clear();
|
||||
self.unknown_fields.clear();
|
||||
}
|
||||
}
|
||||
@ -220,8 +267,9 @@ impl ::protobuf::reflect::ProtobufValue for QueryWorkspaceRequest {
|
||||
#[derive(PartialEq,Clone,Default)]
|
||||
pub struct QueryWorkspaceParams {
|
||||
// message fields
|
||||
pub workspace_id: ::std::string::String,
|
||||
pub read_apps: bool,
|
||||
pub user_id: ::std::string::String,
|
||||
// message oneof groups
|
||||
pub one_of_workspace_id: ::std::option::Option<QueryWorkspaceParams_oneof_one_of_workspace_id>,
|
||||
// special fields
|
||||
pub unknown_fields: ::protobuf::UnknownFields,
|
||||
pub cached_size: ::protobuf::CachedSize,
|
||||
@ -233,6 +281,11 @@ impl<'a> ::std::default::Default for &'a QueryWorkspaceParams {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone,PartialEq,Debug)]
|
||||
pub enum QueryWorkspaceParams_oneof_one_of_workspace_id {
|
||||
workspace_id(::std::string::String),
|
||||
}
|
||||
|
||||
impl QueryWorkspaceParams {
|
||||
pub fn new() -> QueryWorkspaceParams {
|
||||
::std::default::Default::default()
|
||||
@ -242,41 +295,75 @@ impl QueryWorkspaceParams {
|
||||
|
||||
|
||||
pub fn get_workspace_id(&self) -> &str {
|
||||
&self.workspace_id
|
||||
match self.one_of_workspace_id {
|
||||
::std::option::Option::Some(QueryWorkspaceParams_oneof_one_of_workspace_id::workspace_id(ref v)) => v,
|
||||
_ => "",
|
||||
}
|
||||
}
|
||||
pub fn clear_workspace_id(&mut self) {
|
||||
self.workspace_id.clear();
|
||||
self.one_of_workspace_id = ::std::option::Option::None;
|
||||
}
|
||||
|
||||
pub fn has_workspace_id(&self) -> bool {
|
||||
match self.one_of_workspace_id {
|
||||
::std::option::Option::Some(QueryWorkspaceParams_oneof_one_of_workspace_id::workspace_id(..)) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_workspace_id(&mut self, v: ::std::string::String) {
|
||||
self.workspace_id = v;
|
||||
self.one_of_workspace_id = ::std::option::Option::Some(QueryWorkspaceParams_oneof_one_of_workspace_id::workspace_id(v))
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_workspace_id(&mut self) -> &mut ::std::string::String {
|
||||
&mut self.workspace_id
|
||||
if let ::std::option::Option::Some(QueryWorkspaceParams_oneof_one_of_workspace_id::workspace_id(_)) = self.one_of_workspace_id {
|
||||
} else {
|
||||
self.one_of_workspace_id = ::std::option::Option::Some(QueryWorkspaceParams_oneof_one_of_workspace_id::workspace_id(::std::string::String::new()));
|
||||
}
|
||||
match self.one_of_workspace_id {
|
||||
::std::option::Option::Some(QueryWorkspaceParams_oneof_one_of_workspace_id::workspace_id(ref mut v)) => v,
|
||||
_ => panic!(),
|
||||
}
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_workspace_id(&mut self) -> ::std::string::String {
|
||||
::std::mem::replace(&mut self.workspace_id, ::std::string::String::new())
|
||||
if self.has_workspace_id() {
|
||||
match self.one_of_workspace_id.take() {
|
||||
::std::option::Option::Some(QueryWorkspaceParams_oneof_one_of_workspace_id::workspace_id(v)) => v,
|
||||
_ => panic!(),
|
||||
}
|
||||
} else {
|
||||
::std::string::String::new()
|
||||
}
|
||||
}
|
||||
|
||||
// bool read_apps = 2;
|
||||
// string user_id = 2;
|
||||
|
||||
|
||||
pub fn get_read_apps(&self) -> bool {
|
||||
self.read_apps
|
||||
pub fn get_user_id(&self) -> &str {
|
||||
&self.user_id
|
||||
}
|
||||
pub fn clear_read_apps(&mut self) {
|
||||
self.read_apps = false;
|
||||
pub fn clear_user_id(&mut self) {
|
||||
self.user_id.clear();
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_read_apps(&mut self, v: bool) {
|
||||
self.read_apps = v;
|
||||
pub fn set_user_id(&mut self, v: ::std::string::String) {
|
||||
self.user_id = v;
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_user_id(&mut self) -> &mut ::std::string::String {
|
||||
&mut self.user_id
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_user_id(&mut self) -> ::std::string::String {
|
||||
::std::mem::replace(&mut self.user_id, ::std::string::String::new())
|
||||
}
|
||||
}
|
||||
|
||||
@ -290,14 +377,13 @@ impl ::protobuf::Message for QueryWorkspaceParams {
|
||||
let (field_number, wire_type) = is.read_tag_unpack()?;
|
||||
match field_number {
|
||||
1 => {
|
||||
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.workspace_id)?;
|
||||
},
|
||||
2 => {
|
||||
if wire_type != ::protobuf::wire_format::WireTypeVarint {
|
||||
if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
|
||||
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
|
||||
}
|
||||
let tmp = is.read_bool()?;
|
||||
self.read_apps = tmp;
|
||||
self.one_of_workspace_id = ::std::option::Option::Some(QueryWorkspaceParams_oneof_one_of_workspace_id::workspace_id(is.read_string()?));
|
||||
},
|
||||
2 => {
|
||||
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.user_id)?;
|
||||
},
|
||||
_ => {
|
||||
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
|
||||
@ -311,11 +397,15 @@ impl ::protobuf::Message for QueryWorkspaceParams {
|
||||
#[allow(unused_variables)]
|
||||
fn compute_size(&self) -> u32 {
|
||||
let mut my_size = 0;
|
||||
if !self.workspace_id.is_empty() {
|
||||
my_size += ::protobuf::rt::string_size(1, &self.workspace_id);
|
||||
if !self.user_id.is_empty() {
|
||||
my_size += ::protobuf::rt::string_size(2, &self.user_id);
|
||||
}
|
||||
if self.read_apps != false {
|
||||
my_size += 2;
|
||||
if let ::std::option::Option::Some(ref v) = self.one_of_workspace_id {
|
||||
match v {
|
||||
&QueryWorkspaceParams_oneof_one_of_workspace_id::workspace_id(ref v) => {
|
||||
my_size += ::protobuf::rt::string_size(1, &v);
|
||||
},
|
||||
};
|
||||
}
|
||||
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||
self.cached_size.set(my_size);
|
||||
@ -323,11 +413,15 @@ impl ::protobuf::Message for QueryWorkspaceParams {
|
||||
}
|
||||
|
||||
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||
if !self.workspace_id.is_empty() {
|
||||
os.write_string(1, &self.workspace_id)?;
|
||||
if !self.user_id.is_empty() {
|
||||
os.write_string(2, &self.user_id)?;
|
||||
}
|
||||
if self.read_apps != false {
|
||||
os.write_bool(2, self.read_apps)?;
|
||||
if let ::std::option::Option::Some(ref v) = self.one_of_workspace_id {
|
||||
match v {
|
||||
&QueryWorkspaceParams_oneof_one_of_workspace_id::workspace_id(ref v) => {
|
||||
os.write_string(1, v)?;
|
||||
},
|
||||
};
|
||||
}
|
||||
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||
::std::result::Result::Ok(())
|
||||
@ -367,15 +461,15 @@ impl ::protobuf::Message for QueryWorkspaceParams {
|
||||
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
|
||||
descriptor.get(|| {
|
||||
let mut fields = ::std::vec::Vec::new();
|
||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||
fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>(
|
||||
"workspace_id",
|
||||
|m: &QueryWorkspaceParams| { &m.workspace_id },
|
||||
|m: &mut QueryWorkspaceParams| { &mut m.workspace_id },
|
||||
QueryWorkspaceParams::has_workspace_id,
|
||||
QueryWorkspaceParams::get_workspace_id,
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
|
||||
"read_apps",
|
||||
|m: &QueryWorkspaceParams| { &m.read_apps },
|
||||
|m: &mut QueryWorkspaceParams| { &mut m.read_apps },
|
||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||
"user_id",
|
||||
|m: &QueryWorkspaceParams| { &m.user_id },
|
||||
|m: &mut QueryWorkspaceParams| { &mut m.user_id },
|
||||
));
|
||||
::protobuf::reflect::MessageDescriptor::new_pb_name::<QueryWorkspaceParams>(
|
||||
"QueryWorkspaceParams",
|
||||
@ -393,8 +487,8 @@ impl ::protobuf::Message for QueryWorkspaceParams {
|
||||
|
||||
impl ::protobuf::Clear for QueryWorkspaceParams {
|
||||
fn clear(&mut self) {
|
||||
self.workspace_id.clear();
|
||||
self.read_apps = false;
|
||||
self.one_of_workspace_id = ::std::option::Option::None;
|
||||
self.user_id.clear();
|
||||
self.unknown_fields.clear();
|
||||
}
|
||||
}
|
||||
@ -412,25 +506,28 @@ impl ::protobuf::reflect::ProtobufValue for QueryWorkspaceParams {
|
||||
}
|
||||
|
||||
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||
\n\x15workspace_query.proto\"W\n\x15QueryWorkspaceRequest\x12!\n\x0cwork\
|
||||
space_id\x18\x01\x20\x01(\tR\x0bworkspaceId\x12\x1b\n\tread_apps\x18\x02\
|
||||
\x20\x01(\x08R\x08readApps\"V\n\x14QueryWorkspaceParams\x12!\n\x0cworksp\
|
||||
ace_id\x18\x01\x20\x01(\tR\x0bworkspaceId\x12\x1b\n\tread_apps\x18\x02\
|
||||
\x20\x01(\x08R\x08readAppsJ\x9e\x02\n\x06\x12\x04\0\0\t\x01\n\x08\n\x01\
|
||||
\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x05\x01\n\n\n\x03\x04\
|
||||
\0\x01\x12\x03\x02\x08\x1d\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x1c\n\
|
||||
\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\
|
||||
\x12\x03\x03\x0b\x17\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x1a\x1b\n\
|
||||
\x0b\n\x04\x04\0\x02\x01\x12\x03\x04\x04\x17\n\x0c\n\x05\x04\0\x02\x01\
|
||||
\x05\x12\x03\x04\x04\x08\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x04\t\x12\
|
||||
\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x04\x15\x16\n\n\n\x02\x04\x01\x12\
|
||||
\x04\x06\0\t\x01\n\n\n\x03\x04\x01\x01\x12\x03\x06\x08\x1c\n\x0b\n\x04\
|
||||
\x04\x01\x02\0\x12\x03\x07\x04\x1c\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\
|
||||
\x07\x04\n\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x07\x0b\x17\n\x0c\n\x05\
|
||||
\x04\x01\x02\0\x03\x12\x03\x07\x1a\x1b\n\x0b\n\x04\x04\x01\x02\x01\x12\
|
||||
\x03\x08\x04\x17\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\x08\x04\x08\n\
|
||||
\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x08\t\x12\n\x0c\n\x05\x04\x01\x02\
|
||||
\x01\x03\x12\x03\x08\x15\x16b\x06proto3\
|
||||
\n\x15workspace_query.proto\"l\n\x15QueryWorkspaceRequest\x12#\n\x0cwork\
|
||||
space_id\x18\x01\x20\x01(\tH\0R\x0bworkspaceId\x12\x17\n\x07user_id\x18\
|
||||
\x02\x20\x01(\tR\x06userIdB\x15\n\x13one_of_workspace_id\"k\n\x14QueryWo\
|
||||
rkspaceParams\x12#\n\x0cworkspace_id\x18\x01\x20\x01(\tH\0R\x0bworkspace\
|
||||
Id\x12\x17\n\x07user_id\x18\x02\x20\x01(\tR\x06userIdB\x15\n\x13one_of_w\
|
||||
orkspace_idJ\xd4\x02\n\x06\x12\x04\0\0\t\x01\n\x08\n\x01\x0c\x12\x03\0\0\
|
||||
\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x05\x01\n\n\n\x03\x04\0\x01\x12\x03\
|
||||
\x02\x08\x1d\n\x0b\n\x04\x04\0\x08\0\x12\x03\x03\x04:\n\x0c\n\x05\x04\0\
|
||||
\x08\0\x01\x12\x03\x03\n\x1d\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x208\n\
|
||||
\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x03\x20&\n\x0c\n\x05\x04\0\x02\0\x01\
|
||||
\x12\x03\x03'3\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x0367\n\x0b\n\x04\x04\
|
||||
\0\x02\x01\x12\x03\x04\x04\x17\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x04\
|
||||
\x04\n\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x04\x0b\x12\n\x0c\n\x05\x04\
|
||||
\0\x02\x01\x03\x12\x03\x04\x15\x16\n\n\n\x02\x04\x01\x12\x04\x06\0\t\x01\
|
||||
\n\n\n\x03\x04\x01\x01\x12\x03\x06\x08\x1c\n\x0b\n\x04\x04\x01\x08\0\x12\
|
||||
\x03\x07\x04:\n\x0c\n\x05\x04\x01\x08\0\x01\x12\x03\x07\n\x1d\n\x0b\n\
|
||||
\x04\x04\x01\x02\0\x12\x03\x07\x208\n\x0c\n\x05\x04\x01\x02\0\x05\x12\
|
||||
\x03\x07\x20&\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x07'3\n\x0c\n\x05\
|
||||
\x04\x01\x02\0\x03\x12\x03\x0767\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x08\
|
||||
\x04\x17\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\x08\x04\n\n\x0c\n\x05\
|
||||
\x04\x01\x02\x01\x01\x12\x03\x08\x0b\x12\n\x0c\n\x05\x04\x01\x02\x01\x03\
|
||||
\x12\x03\x08\x15\x16b\x06proto3\
|
||||
";
|
||||
|
||||
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
|
||||
|
@ -26,7 +26,6 @@
|
||||
#[derive(PartialEq,Clone,Default)]
|
||||
pub struct CurrentWorkspace {
|
||||
// message fields
|
||||
pub owner: ::std::string::String,
|
||||
pub workspace_id: ::std::string::String,
|
||||
// special fields
|
||||
pub unknown_fields: ::protobuf::UnknownFields,
|
||||
@ -44,33 +43,7 @@ impl CurrentWorkspace {
|
||||
::std::default::Default::default()
|
||||
}
|
||||
|
||||
// string owner = 1;
|
||||
|
||||
|
||||
pub fn get_owner(&self) -> &str {
|
||||
&self.owner
|
||||
}
|
||||
pub fn clear_owner(&mut self) {
|
||||
self.owner.clear();
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
pub fn set_owner(&mut self, v: ::std::string::String) {
|
||||
self.owner = v;
|
||||
}
|
||||
|
||||
// Mutable pointer to the field.
|
||||
// If field is not initialized, it is initialized with default value first.
|
||||
pub fn mut_owner(&mut self) -> &mut ::std::string::String {
|
||||
&mut self.owner
|
||||
}
|
||||
|
||||
// Take field
|
||||
pub fn take_owner(&mut self) -> ::std::string::String {
|
||||
::std::mem::replace(&mut self.owner, ::std::string::String::new())
|
||||
}
|
||||
|
||||
// string workspace_id = 2;
|
||||
// string workspace_id = 1;
|
||||
|
||||
|
||||
pub fn get_workspace_id(&self) -> &str {
|
||||
@ -107,9 +80,6 @@ impl ::protobuf::Message for CurrentWorkspace {
|
||||
let (field_number, wire_type) = is.read_tag_unpack()?;
|
||||
match field_number {
|
||||
1 => {
|
||||
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.owner)?;
|
||||
},
|
||||
2 => {
|
||||
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.workspace_id)?;
|
||||
},
|
||||
_ => {
|
||||
@ -124,11 +94,8 @@ impl ::protobuf::Message for CurrentWorkspace {
|
||||
#[allow(unused_variables)]
|
||||
fn compute_size(&self) -> u32 {
|
||||
let mut my_size = 0;
|
||||
if !self.owner.is_empty() {
|
||||
my_size += ::protobuf::rt::string_size(1, &self.owner);
|
||||
}
|
||||
if !self.workspace_id.is_empty() {
|
||||
my_size += ::protobuf::rt::string_size(2, &self.workspace_id);
|
||||
my_size += ::protobuf::rt::string_size(1, &self.workspace_id);
|
||||
}
|
||||
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||
self.cached_size.set(my_size);
|
||||
@ -136,11 +103,8 @@ impl ::protobuf::Message for CurrentWorkspace {
|
||||
}
|
||||
|
||||
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
|
||||
if !self.owner.is_empty() {
|
||||
os.write_string(1, &self.owner)?;
|
||||
}
|
||||
if !self.workspace_id.is_empty() {
|
||||
os.write_string(2, &self.workspace_id)?;
|
||||
os.write_string(1, &self.workspace_id)?;
|
||||
}
|
||||
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||
::std::result::Result::Ok(())
|
||||
@ -180,11 +144,6 @@ impl ::protobuf::Message for CurrentWorkspace {
|
||||
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
|
||||
descriptor.get(|| {
|
||||
let mut fields = ::std::vec::Vec::new();
|
||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||
"owner",
|
||||
|m: &CurrentWorkspace| { &m.owner },
|
||||
|m: &mut CurrentWorkspace| { &mut m.owner },
|
||||
));
|
||||
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
|
||||
"workspace_id",
|
||||
|m: &CurrentWorkspace| { &m.workspace_id },
|
||||
@ -206,7 +165,6 @@ impl ::protobuf::Message for CurrentWorkspace {
|
||||
|
||||
impl ::protobuf::Clear for CurrentWorkspace {
|
||||
fn clear(&mut self) {
|
||||
self.owner.clear();
|
||||
self.workspace_id.clear();
|
||||
self.unknown_fields.clear();
|
||||
}
|
||||
@ -225,16 +183,13 @@ impl ::protobuf::reflect::ProtobufValue for CurrentWorkspace {
|
||||
}
|
||||
|
||||
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||
\n\x1bworkspace_user_detail.proto\"K\n\x10CurrentWorkspace\x12\x14\n\x05\
|
||||
owner\x18\x01\x20\x01(\tR\x05owner\x12!\n\x0cworkspace_id\x18\x02\x20\
|
||||
\x01(\tR\x0bworkspaceIdJ\x98\x01\n\x06\x12\x04\0\0\x05\x01\n\x08\n\x01\
|
||||
\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x05\x01\n\n\n\x03\x04\
|
||||
\0\x01\x12\x03\x02\x08\x18\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x15\n\
|
||||
\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\
|
||||
\x12\x03\x03\x0b\x10\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x13\x14\n\
|
||||
\x0b\n\x04\x04\0\x02\x01\x12\x03\x04\x04\x1c\n\x0c\n\x05\x04\0\x02\x01\
|
||||
\x05\x12\x03\x04\x04\n\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x04\x0b\x17\
|
||||
\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x04\x1a\x1bb\x06proto3\
|
||||
\n\x1bworkspace_user_detail.proto\"5\n\x10CurrentWorkspace\x12!\n\x0cwor\
|
||||
kspace_id\x18\x01\x20\x01(\tR\x0bworkspaceIdJa\n\x06\x12\x04\0\0\x04\x01\
|
||||
\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x04\x01\n\
|
||||
\n\n\x03\x04\0\x01\x12\x03\x02\x08\x18\n\x0b\n\x04\x04\0\x02\0\x12\x03\
|
||||
\x03\x04\x1c\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x03\x04\n\n\x0c\n\x05\
|
||||
\x04\0\x02\0\x01\x12\x03\x03\x0b\x17\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\
|
||||
\x03\x1a\x1bb\x06proto3\
|
||||
";
|
||||
|
||||
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
|
||||
|
@ -1,10 +1,10 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message QueryWorkspaceRequest {
|
||||
string workspace_id = 1;
|
||||
bool read_apps = 2;
|
||||
oneof one_of_workspace_id { string workspace_id = 1; };
|
||||
string user_id = 2;
|
||||
}
|
||||
message QueryWorkspaceParams {
|
||||
string workspace_id = 1;
|
||||
bool read_apps = 2;
|
||||
oneof one_of_workspace_id { string workspace_id = 1; };
|
||||
string user_id = 2;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message CurrentWorkspace {
|
||||
string owner = 1;
|
||||
string workspace_id = 2;
|
||||
string workspace_id = 1;
|
||||
}
|
||||
|
@ -64,7 +64,20 @@ impl WorkspaceController {
|
||||
|
||||
pub async fn read_cur_workspace(&self) -> Result<Workspace, WorkspaceError> {
|
||||
let user_workspace = self.user.get_cur_workspace().await?;
|
||||
let workspace = self.read_workspace(&user_workspace.workspace_id).await?;
|
||||
let mut repeated_workspace = self
|
||||
.read_workspaces(Some(user_workspace.workspace_id.clone()))
|
||||
.await?;
|
||||
|
||||
if repeated_workspace.is_empty() {
|
||||
return Err(ErrorBuilder::new(WsErrCode::RecordNotFound).build());
|
||||
}
|
||||
|
||||
debug_assert_eq!(repeated_workspace.len(), 1);
|
||||
let workspace = repeated_workspace
|
||||
.drain(..1)
|
||||
.collect::<Vec<Workspace>>()
|
||||
.pop()
|
||||
.unwrap();
|
||||
Ok(workspace)
|
||||
}
|
||||
|
||||
@ -74,9 +87,31 @@ impl WorkspaceController {
|
||||
Ok(apps)
|
||||
}
|
||||
|
||||
pub async fn read_workspace(&self, workspace_id: &str) -> Result<Workspace, WorkspaceError> {
|
||||
let workspace_table = self.read_workspace_table(workspace_id).await?;
|
||||
Ok(workspace_table.into())
|
||||
pub async fn open_workspace(&self, workspace_id: &str) -> Result<Workspace, WorkspaceError> {
|
||||
let user_id = self.user.user_id()?;
|
||||
let result = self
|
||||
.read_workspace_table(Some(workspace_id.to_owned()), user_id)
|
||||
.await?
|
||||
.first();
|
||||
|
||||
match result {
|
||||
None => Err(ErrorBuilder::new(WsErrCode::RecordNotFound).build()),
|
||||
Some(workspace_table) => {
|
||||
let workspace: Workspace = workspace_table.into();
|
||||
Ok(workspace)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn read_workspaces(
|
||||
&self,
|
||||
workspace_id: Option<String>,
|
||||
) -> Result<RepeatedWorkspace, WorkspaceError> {
|
||||
let user_id = self.user.user_id()?;
|
||||
let workspace_tables = self.read_workspace_table(workspace_id, user_id).await?;
|
||||
let mut workspaces = vec![];
|
||||
|
||||
Ok(RepeatedWorkspace { items: workspaces })
|
||||
}
|
||||
|
||||
pub async fn read_workspaces_belong_to_user(&self) -> Result<Vec<Workspace>, WorkspaceError> {
|
||||
@ -104,13 +139,14 @@ impl WorkspaceController {
|
||||
|
||||
fn read_workspace_table(
|
||||
&self,
|
||||
workspace_id: &str,
|
||||
) -> DispatchFuture<Result<WorkspaceTable, WorkspaceError>> {
|
||||
workspace_id: Option<String>,
|
||||
user_id: String,
|
||||
) -> DispatchFuture<Result<Vec<WorkspaceTable>, WorkspaceError>> {
|
||||
let sql = self.sql.clone();
|
||||
let workspace_id = workspace_id.to_owned();
|
||||
DispatchFuture {
|
||||
fut: Box::pin(async move {
|
||||
let workspace = sql.read_workspace(&workspace_id)?;
|
||||
let workspace = sql.read_workspaces(workspace_id, &user_id)?;
|
||||
// TODO: fetch workspace from remote server
|
||||
Ok(workspace)
|
||||
}),
|
||||
@ -131,26 +167,20 @@ pub async fn create_workspace_request(
|
||||
Ok(workspace)
|
||||
}
|
||||
|
||||
pub async fn read_workspace_request(
|
||||
pub async fn read_workspaces_request(
|
||||
params: QueryWorkspaceParams,
|
||||
url: &str,
|
||||
) -> Result<Option<Workspace>, WorkspaceError> {
|
||||
) -> Result<RepeatedWorkspace, WorkspaceError> {
|
||||
let result = HttpRequestBuilder::get(&url.to_owned())
|
||||
.protobuf(params)?
|
||||
.send()
|
||||
.await?
|
||||
.response::<Workspace>()
|
||||
.response::<RepeatedWorkspace>()
|
||||
.await;
|
||||
|
||||
match result {
|
||||
Ok(workspace) => Ok(Some(workspace)),
|
||||
Err(e) => {
|
||||
if e.is_not_found() {
|
||||
Ok(None)
|
||||
} else {
|
||||
Err(e.into())
|
||||
}
|
||||
},
|
||||
Ok(repeated_workspace) => Ok(repeated_workspace),
|
||||
Err(e) => Err(e.into()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,12 +24,20 @@ impl WorkspaceSql {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn read_workspace(&self, workspace_id: &str) -> Result<WorkspaceTable, WorkspaceError> {
|
||||
let workspace = dsl::workspace_table
|
||||
.filter(workspace_table::id.eq(&workspace_id))
|
||||
.first::<WorkspaceTable>(&*(self.database.db_connection()?))?;
|
||||
pub fn read_workspaces(
|
||||
&self,
|
||||
workspace_id: Option<String>,
|
||||
user_id: &str,
|
||||
) -> Result<Vec<WorkspaceTable>, WorkspaceError> {
|
||||
let mut filter = dsl::workspace_table.filter(workspace_table::user_id.eq(user_id));
|
||||
|
||||
Ok(workspace)
|
||||
if let Some(workspace_id) = workspace_id {
|
||||
filter.filter(workspace_table::id.eq(&workspace_id));
|
||||
}
|
||||
|
||||
let workspaces = filter.load::<WorkspaceTable>(&*(self.database.db_connection()?))?;
|
||||
|
||||
Ok(workspaces)
|
||||
}
|
||||
|
||||
pub fn update_workspace(
|
||||
|
Reference in New Issue
Block a user