|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+# Backend: Matching
|
|
|
2
|
+
|
|
|
3
|
+Plugin repsonsibe for finding, scoring, and matching `Profiles` for a proposing `User`.
|
|
|
4
|
+
|
|
|
5
|
+```mermaid
|
|
|
6
|
+classDiagram
|
|
|
7
|
+ MatchPlugin ..> MatchMaker : dependency
|
|
|
8
|
+ MatchMaker ..> ScoreKeeper : dependency
|
|
|
9
|
+
|
|
|
10
|
+ class MatchPlugin {
|
|
|
11
|
+ +String owner
|
|
|
12
|
+ +Bigdecimal balance
|
|
|
13
|
+ +deposit(amount)
|
|
|
14
|
+ }
|
|
|
15
|
+ class MatchMaker {
|
|
|
16
|
+ +String owner
|
|
|
17
|
+ +Bigdecimal balance
|
|
|
18
|
+ +deposit(amount)
|
|
|
19
|
+ }
|
|
|
20
|
+ class ScoreKeeper {
|
|
|
21
|
+ +String owner
|
|
|
22
|
+ +Bigdecimal balance
|
|
|
23
|
+ +deposit(amount)
|
|
|
24
|
+ }
|
|
|
25
|
+```
|
|
|
26
|
+
|
|
|
27
|
+## Routes
|
|
|
28
|
+
|
|
|
29
|
+### `GET /match`
|
|
|
30
|
+```mermaid
|
|
|
31
|
+sequenceDiagram
|
|
|
32
|
+ participant D as db
|
|
|
33
|
+ participant A as match:route
|
|
|
34
|
+ participant B as match:plugin
|
|
|
35
|
+ participant C as MatchMaker
|
|
|
36
|
+ participant E as ScoreKeeper
|
|
|
37
|
+
|
|
|
38
|
+ A->>B: START
|
|
|
39
|
+
|
|
|
40
|
+ alt not cached
|
|
|
41
|
+ B->>D: SELECT Profiles
|
|
|
42
|
+ D-->>B: Profiles
|
|
|
43
|
+ B->>C: send Profiles | Profile | User
|
|
|
44
|
+ loop Profile in Profiles
|
|
|
45
|
+ C->>E: Profile
|
|
|
46
|
+ E-->>C: scored Profile
|
|
|
47
|
+ end
|
|
|
48
|
+ C-->>B: scored Profiles
|
|
|
49
|
+ B->>???: scored Profiles
|
|
|
50
|
+ else cached
|
|
|
51
|
+ B->>???: check cache
|
|
|
52
|
+ end
|
|
|
53
|
+
|
|
|
54
|
+
|
|
|
55
|
+
|
|
|
56
|
+ ???-->>B: Profiles
|
|
|
57
|
+ B->>A: ordered Profiles
|
|
|
58
|
+```
|
|
|
59
|
+
|
|
|
60
|
+### `POST /match`
|
|
|
61
|
+```mermaid
|
|
|
62
|
+sequenceDiagram
|
|
|
63
|
+ participant D as db
|
|
|
64
|
+ participant A as match:route
|
|
|
65
|
+ participant B as match:plugin
|
|
|
66
|
+ participant C as MatchMaker
|
|
|
67
|
+ participant E as ScoreKeeper
|
|
|
68
|
+
|
|
|
69
|
+ A->>B: START
|
|
|
70
|
+```
|