diff --git a/src/data/repo/IProjectRepository.hpp b/src/data/repo/IProjectRepository.hpp new file mode 100644 index 0000000..e064370 --- /dev/null +++ b/src/data/repo/IProjectRepository.hpp @@ -0,0 +1,27 @@ +#pragma once +#include +#include +#include "repo/RepoTypes.hpp" + +namespace geopro::data { + +// 仓储结果信封:网络可失败,故用显式 Result 而非抛异常,便于 UI 出错误/空状态。 +template +struct RepoResult { + bool ok = false; + T value{}; + std::string error; +}; + +// 导航仓储抽象(同步;呼应既有 IDatasetRepository 风格)。 +class IProjectRepository { +public: + virtual ~IProjectRepository() = default; + virtual RepoResult> listWorkspaces() = 0; + virtual RepoResult switchWorkspace(const std::string& tenantId) = 0; + virtual RepoResult> listProjects(const std::string& lastProjectId) = 0; + virtual RepoResult> loadStructure(const std::string& projectId) = 0; + virtual RepoResult> loadDatasetsOfTm(const std::string& tmObjectId) = 0; +}; + +} // namespace geopro::data diff --git a/src/data/repo/RepoTypes.hpp b/src/data/repo/RepoTypes.hpp index b671c54..f78aeff 100644 --- a/src/data/repo/RepoTypes.hpp +++ b/src/data/repo/RepoTypes.hpp @@ -6,4 +6,13 @@ struct DsNode { std::string id, name, ddType; }; struct TmNode { std::string id, name, confCode; std::vector dss; }; struct GsNode { std::string id, name; std::vector tms; }; struct Project { std::string id, name; std::vector gss; }; + +// 工作空间(=企业租户/空间)。ownerType: 1 个人空间 2 企业空间。 +struct Workspace { std::string id, name; int ownerType = 0; bool isCurrent = false; }; + +// 项目摘要(列表用)。crsCode/crsName 为项目参考坐标系,下一轮替换硬编码 EPSG:4547。 +struct ProjectSummary { std::string id, name, typeName, crsCode, crsName; int status = 0; }; + +// 项目结构扁平节点(仅 GS / TM)。客户端按 parentId 建树,叶子=TM。 +struct StructNode { std::string id, name, parentId, typeName, confCode; int type = 0; }; } // namespace geopro::data