Skip to content

Commit

Permalink
Merge pull request #46 from xxanxnie/Fix/routernoresponse
Browse files Browse the repository at this point in the history
Format coding style and fix no reponse bugs
  • Loading branch information
BrendonJYHsieh authored Nov 26, 2024
2 parents ce470b4 + a395eac commit 2a4a361
Show file tree
Hide file tree
Showing 5 changed files with 431 additions and 303 deletions.
8 changes: 4 additions & 4 deletions include/MockDatabaseManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class MockDatabaseManager : public DatabaseManager {
MOCK_METHOD(
void, findCollection,
(int start, (const std::string &collectionName),
(const std::vector<std::pair<std::string, std::string>> &keyValues),
(std::vector<bsoncxx::document::value> &result)),
(const std::vector<std::pair<std::string, std::string>> &keyValues),
(std::vector<bsoncxx::document::value> & result)),
(override));

MOCK_METHOD(
Expand All @@ -30,8 +30,8 @@ class MockDatabaseManager : public DatabaseManager {
(override));

MOCK_METHOD(bool, deleteResource,
(const std::string& collectionName,
(const std::string& id)), (override));
(const std::string &collectionName, (const std::string &id)),
(override));
};

#endif // MOCK_DATABASE_MANAGER_H
27 changes: 16 additions & 11 deletions include/SubscriptionManager.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
// Copyright 2024 COMSW4156-Git-Gud
#pragma once

#include "DatabaseManager.h"
#include <map>
#include <string>
#include <vector>

#include "DatabaseManager.h"

class SubscriptionManager {
public:
SubscriptionManager(DatabaseManager& dbManager);
virtual std::string addSubscriber(const std::map<std::string, std::string>& subscriberDetails);
virtual std::string deleteSubscriber(const std::string& id);
virtual std::map<std::string, std::string> getSubscribers(const std::string& resource, const std::string& city);
virtual void notifySubscribers(const std::string& resource, const std::string& city);
public:
SubscriptionManager(DatabaseManager& dbManager);
virtual std::string addSubscriber(
const std::map<std::string, std::string>& subscriberDetails);
virtual std::string deleteSubscriber(const std::string& id);
virtual std::map<std::string, std::string> getSubscribers(
const std::string& resource, const std::string& city);
virtual void notifySubscribers(const std::string& resource,
const std::string& city);

private:
DatabaseManager& dbManager;
private:
DatabaseManager& dbManager;

void sendEmail(const std::string& to, const std::string& subject, const std::string& content);
void sendWebhook(const std::string& url, const std::string& payload);
void sendEmail(const std::string& to, const std::string& subject,
const std::string& content);
void sendWebhook(const std::string& url, const std::string& payload);
};
Loading

0 comments on commit 2a4a361

Please sign in to comment.