-
Notifications
You must be signed in to change notification settings - Fork 125
/
categoryLibrary.sol
30 lines (22 loc) · 1.13 KB
/
categoryLibrary.sol
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
pragma solidity ^0.4.8;
import "ethlanceDB.sol";
import "sharedLibrary.sol";
library CategoryLibrary {
function addJob(address db, uint categoryId, uint jobId) internal {
SharedLibrary.addArrayItem(db, categoryId, "category/jobs", "category/jobs-count", jobId);
}
function getJobs(address db, uint categoryId) internal returns (uint[]) {
return SharedLibrary.getUIntArray(db, categoryId, "category/jobs", "category/jobs-count");
}
function addFreelancer(address db, uint[] categories, uint userId) internal {
SharedLibrary.addRemovableArrayItem(db, categories, "category/freelancers", "category/freelancers-count",
"category/freelancers-keys", userId);
}
function getFreelancers(address db, uint categoryId) internal returns (uint[]) {
return SharedLibrary.getRemovableArrayItems(db, categoryId, "category/freelancers", "category/freelancers-count",
"category/freelancers-keys");
}
function removeFreelancer(address db, uint[] categories, uint userId) internal {
SharedLibrary.removeArrayItem(db, categories, "category/freelancers", userId);
}
}