OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
MongoProjectFunctions.h
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4#include <cstdint>
5#include <iostream>
6#include <vector>
7#include <ctime>
8#include <sstream>
9#include <bsoncxx/json.hpp>
10#include <bsoncxx/types.hpp>
11#include <mongocxx/client.hpp>
12#include <mongocxx/stdx.hpp>
13#include <mongocxx/uri.hpp>
14#include <mongocxx/instance.hpp>
15#include <bsoncxx/builder/stream/helpers.hpp>
16#include <bsoncxx/builder/stream/document.hpp>
17#include <bsoncxx/builder/stream/array.hpp>
18
19#include "User.h"
20#include "Project.h"
21
22using bsoncxx::builder::stream::close_array;
23using bsoncxx::builder::stream::close_document;
24using bsoncxx::builder::stream::document;
25using bsoncxx::builder::stream::finalize;
26using bsoncxx::builder::stream::open_array;
27using bsoncxx::builder::stream::open_document;
28using bsoncxx::document::value;
29using bsoncxx::document::view;
30using bsoncxx::document::element;
31
32
34{
35
36 Project createProject(std::string projectName, std::string projectType, User& creatingUser, mongocxx::client& adminClient);
37
38 std::string generateProjectCollectionName(mongocxx::client& adminClient);
39
40 Project getProject(bsoncxx::oid& projectId, mongocxx::client& userClient);
41
42 Project getProject(std::string projectName, mongocxx::client& userClient);
43
44 std::string getProjectsInfo(const std::list<std::string>& _projectNames, mongocxx::client& _adminClient);
45
46 std::vector<Project> getAllGroupProjects(Group& group, mongocxx::client& userClient);
47
48 std::vector<Project> getAllUserProjects(User& loggedInUser, std::string filter, int limit, mongocxx::client& userClient);
49
50 std::vector<Project> getAllProjects(User& loggedInUser, std::string filter, int limit, mongocxx::client& userClient);
51 size_t getAllProjectCount(User& loggedInUser, mongocxx::client& userClient);
52
53 Project changeProjectName(Project& project, std::string newName, mongocxx::client& adminClient);
54
55 Project changeProjectOwner(Project& project, User& newOwner, mongocxx::client& adminClient);
56
57 bool addGroupToProject(Group& group, Project& project, mongocxx::client& adminClient);
58
59 bool removeGroupFromProject(Group& group, Project& project, mongocxx::client& adminClient);
60
61 bool removeProject(Project& project, mongocxx::client& adminClient);
62
63 bool changeProjectCreator(bsoncxx::oid& projectId, User& oldOwner, User& newOwner, mongocxx::client& adminClient);
64
65 bool checkForCollectionExistence(const std::string& collectionName, mongocxx::client& loggedInUser);
66
67 std::string projectToJson(Project& project);
68
69 std::string projectsToJson(std::vector<Project>& projects);
70
71}
Definition Group.h:20
Definition Project.h:15
Definition User.h:20
Definition MongoProjectFunctions.h:34
std::string generateProjectCollectionName(mongocxx::client &adminClient)
Definition MongoProjectFunctions.cpp:58
Project changeProjectOwner(Project &project, User &newOwner, mongocxx::client &adminClient)
Definition MongoProjectFunctions.cpp:337
std::vector< Project > getAllGroupProjects(Group &group, mongocxx::client &userClient)
Definition MongoProjectFunctions.cpp:282
std::string getProjectsInfo(const std::list< std::string > &_projectNames, mongocxx::client &_adminClient)
Definition MongoProjectFunctions.cpp:134
std::vector< Project > getAllUserProjects(User &loggedInUser, std::string filter, int limit, mongocxx::client &userClient)
Definition MongoProjectFunctions.cpp:161
bool changeProjectCreator(bsoncxx::oid &projectId, User &oldOwner, User &newOwner, mongocxx::client &adminClient)
Definition MongoProjectFunctions.cpp:520
bool checkForCollectionExistence(const std::string &collectionName, mongocxx::client &loggedInUser)
Definition MongoProjectFunctions.cpp:564
std::vector< Project > getAllProjects(User &loggedInUser, std::string filter, int limit, mongocxx::client &userClient)
Definition MongoProjectFunctions.cpp:244
bool removeProject(Project &project, mongocxx::client &adminClient)
Definition MongoProjectFunctions.cpp:479
std::string projectToJson(Project &project)
Definition MongoProjectFunctions.cpp:570
Project createProject(std::string projectName, std::string projectType, User &creatingUser, mongocxx::client &adminClient)
Definition MongoProjectFunctions.cpp:21
bool removeGroupFromProject(Group &group, Project &project, mongocxx::client &adminClient)
Definition MongoProjectFunctions.cpp:425
bool addGroupToProject(Group &group, Project &project, mongocxx::client &adminClient)
Definition MongoProjectFunctions.cpp:375
Project changeProjectName(Project &project, std::string newName, mongocxx::client &adminClient)
Definition MongoProjectFunctions.cpp:303
Project getProject(bsoncxx::oid &projectId, mongocxx::client &userClient)
Definition MongoProjectFunctions.cpp:92
std::string projectsToJson(std::vector< Project > &projects)
Definition MongoProjectFunctions.cpp:590
size_t getAllProjectCount(User &loggedInUser, mongocxx::client &userClient)
Definition MongoProjectFunctions.cpp:272