summaryrefslogtreecommitdiffstats
path: root/server/src/database/schema.cppm
blob: a34edeffb34d99c2787523b818f076842a5b4df5 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
export module routemon:database.schema;

import std;
import :time;

namespace routemon::database::schema {

constexpr std::int64_t expected_version = 2;

enum class rwgps_notification_cause
{
  unknown,
  created,
  updated,
  deleted,
  added,
  removed,
};

auto try_to_string(rwgps_notification_cause c) -> std::optional<std::string>;

enum class rwgps_notification_item_type
{
  unknown,
  trip,
  route,
  event,
  event_participant,
  club_member,
  authorization,
};

auto try_to_string(rwgps_notification_item_type t)
    -> std::optional<std::string>;

enum rwgps_notification_target_collection_type
{
  unknown,
  pinned,
};

auto try_to_string(rwgps_notification_target_collection_type t)
    -> std::optional<std::string>;

struct rwgps_notification_target_collection
{
  std::int64_t notification_id = 0;
  std::int64_t id;
  rwgps_notification_target_collection_type type;
  std::optional<std::string> url;
};

struct rwgps_notification
{
  std::int64_t id = 0;
  time::timestamp<std::chrono::seconds> rwgps_timestamp;
  // User that took the action
  std::int64_t user_id;
  rwgps_notification_item_type item_type;
  std::optional<std::int64_t> item_id;
  // User that owns the item
  std::optional<std::int64_t> item_user_id;
  std::optional<std::string> item_url;
  rwgps_notification_cause action;
};

} // namespace routemon::database::schema