-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblockaid.cpp
More file actions
59 lines (42 loc) · 1.67 KB
/
blockaid.cpp
File metadata and controls
59 lines (42 loc) · 1.67 KB
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
#include "blockaid.hpp"
namespace blockaid {
void blockaid::uploadinfo( account_name user, std::string packed_data, std::string memo) {
require_auth(user);
user_data_table _userdata(_self, user);
auto info_id = _userdata.available_primary_key();
_userdata.emplace(user, [&](auto &the_info) {
the_info.info_id = info_id;
the_info.packed_data = packed_data;
});
}
void blockaid::updateinfo( account_name user, uint64_t info_id, std::string packed_data, std::string memo) {
require_auth(user);
user_data_table _userdata(_self, user);
auto itr = _userdata.find(info_id);
_userdata.modify(itr, 0, [&](auto &the_info) {
the_info.packed_data = packed_data;
the_info.update_time = now();
});
}
void blockaid::reqremove( account_name user, uint64_t reg_info_id, std::string memo) {
require_auth(user);
request_table _requests(_self, user);
auto req_id = _requests.available_primary_key();
_requests.emplace(user, [&](auto &the_req) {
the_req.req_id = req_id;
the_req.info_id = reg_info_id;
the_req.status = "pending";
});
}
void blockaid::updatereq(account_name user, uint64_t req_id, std::string new_status, std::string memo) {
require_auth(_self);
request_table _requests(_self, user);
auto itr = _requests.find(req_id);
_requests.modify(itr, _self, [&](auto &the_req) {
the_req.status = new_status;
the_req.update_time = now();
});
}
blockaid::blockaid(account_name self) : contract(self){
}
}