-
Notifications
You must be signed in to change notification settings - Fork 0
/
request.h
117 lines (102 loc) · 2.41 KB
/
request.h
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#ifndef REQUEST_MODEL
#define REQUEST_MODEL
#include "user.h"
#include "../controller/customer.h"
#include "../controller/loan.h"
#include "../controller/feedback.h"
typedef enum e_req_type {
REQLOGIN,
REQGETUSR,
REQGETUSRROLE,
REQCHPW,
REQREGISTER,
REQUPDTUSR,
REQDLTUSR,
REQDEPOSIT,
REQWITHDRAW,
REQTRANSFER,
REQVIEWTRAN,
REQLNAPPL,
REQLNASSGNPOST,
REQLNRVPOST,
REQADDFDBK,
// need no data
REQGETBAL,
REQLNASSGNGET,
REQLNRVGET,
REQLNCUSTGET,
REQGETEMPS,
REQGETFDBK,
REQLOGOUT
} req_type;
typedef struct s_req_login_data {
char uname[UN_LEN];
char pw[PW_LEN];
} req_login_data;
typedef struct s_req_getusr_data {
char uname[UN_LEN];
} req_getusr_data;
typedef struct s_req_chpw_data {
char oldpw[PW_LEN];
char newpw[PW_LEN];
} req_chpw_data;
typedef struct s_req_ureg_data {
char uname[UN_LEN];
char pw[PW_LEN];
user_role role;
PersonalInfo info;
} req_ureg_data;
typedef struct s_req_uupdt_data {
char uname[UN_LEN];
char nuname[UN_LEN];
char pw[PW_LEN];
// common to s_get_usr_data
user_role role;
PersonalInfo info;
acc_state cust_state;
long cust_balance;
} req_uupdt_data;
typedef struct s_transfer_data {
char oun[UN_LEN];
float amt;
} transfer_data;
typedef struct s_view_tran_data {
char un[UN_LEN];
int page_num;
} view_tran_data;
typedef struct s_ln_assgn_post_data {
long loan_id;
char eun[UN_LEN];
} ln_assgn_post_data;
typedef struct s_ln_rv_post_data {
long loan_id;
loan_status status;
float acpt_amt;
float rate;
char reason[128];
} ln_rv_post_data;
typedef struct s_add_fdbk_data {
feedback_category cat;
char text[FDBK_TEXT_LEN];
} add_fdbk_data;
typedef union u_req_data
{
req_login_data login; // REQLOGIN
char getusr[UN_LEN]; // REQGETUSR, REQGETUSRROLE
req_chpw_data chpw; // REQCHPW
req_ureg_data ureg; // REQREGISTER
req_uupdt_data uupdt; // REQUPDTUSR
char udlt[UN_LEN]; // REQDLTUSR
float baldelta; // REQDEPOSIT, REQWITHDRAW
transfer_data transfer; // REQTRANSFER
view_tran_data viewtran; // REQVIEWTRAN
Loan loanappl; // REQLNAPPL
ln_assgn_post_data lnassgn; // REQLNASSGNPOST
ln_rv_post_data lnrv; // REQLNRVPOST
add_fdbk_data fdbk; // REQADDFDBK
} req_data;
typedef struct s_request {
req_type type;
req_data data;
} Request;
#endif // REQUEST_MODEL