mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
fixed space creation api
This commit is contained in:
@ -1,7 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/community_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/create_subspace_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/space_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/space_response_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/create_space_template_body_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_body_model.dart';
|
||||
import 'package:syncrow_web/services/api/http_service.dart';
|
||||
import 'package:syncrow_web/utils/constants/api_const.dart';
|
||||
import 'package:syncrow_web/utils/constants/temp_const.dart';
|
||||
@ -161,15 +164,17 @@ class CommunitySpaceManagementApi {
|
||||
}
|
||||
}
|
||||
|
||||
Future<SpaceModel?> createSpace({
|
||||
required String communityId,
|
||||
required String name,
|
||||
String? parentId,
|
||||
String? direction,
|
||||
bool isPrivate = false,
|
||||
required Offset position,
|
||||
String? icon,
|
||||
}) async {
|
||||
Future<SpaceModel?> createSpace(
|
||||
{required String communityId,
|
||||
required String name,
|
||||
String? parentId,
|
||||
String? direction,
|
||||
bool isPrivate = false,
|
||||
required Offset position,
|
||||
String? spaceModelUuid,
|
||||
String? icon,
|
||||
List<CreateTagBodyModel>? tags,
|
||||
List<CreateSubspaceModel>? subspaces}) async {
|
||||
try {
|
||||
final body = {
|
||||
'spaceName': name,
|
||||
@ -182,6 +187,13 @@ class CommunitySpaceManagementApi {
|
||||
if (parentId != null) {
|
||||
body['parentUuid'] = parentId;
|
||||
}
|
||||
if (tags != null) {
|
||||
body['tags'] = tags;
|
||||
}
|
||||
|
||||
if (spaceModelUuid != null) body['spaceModelUuid'] = spaceModelUuid;
|
||||
|
||||
if (subspaces != null) body['subspaces'] = subspaces;
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.createSpace
|
||||
.replaceAll('{communityId}', communityId)
|
||||
@ -263,7 +275,6 @@ class CommunitySpaceManagementApi {
|
||||
.replaceAll('{communityId}', communityId)
|
||||
.replaceAll('{projectId}', TempConst.projectId),
|
||||
expectedResponseModel: (json) {
|
||||
print(json);
|
||||
final spaceModels = (json['data'] as List)
|
||||
.map((spaceJson) => SpaceModel.fromJson(spaceJson))
|
||||
.toList();
|
||||
|
Reference in New Issue
Block a user