@@ -20,13 +20,13 @@ const accountRole = {
2020} ;
2121
2222const adminRole = {
23- "_id" : mongoose . Types . ObjectId ( ) ,
23+ "_id" : mongoose . Types . ObjectId . createFromTime ( 1 ) ,
2424 "name" : Constants . General . STAFF ,
2525 "routes" : Constants . Routes . listAllRoutes ( ) ,
2626} ;
2727
2828const hackerRole = {
29- "_id" : mongoose . Types . ObjectId ( ) ,
29+ "_id" : mongoose . Types . ObjectId . createFromTime ( 2 ) ,
3030 "name" : Constants . General . HACKER ,
3131 "routes" : [
3232 Constants . Routes . accountRoutes . getSelf ,
@@ -43,7 +43,7 @@ const hackerRole = {
4343} ;
4444
4545const volunteerRole = {
46- "_id" : mongoose . Types . ObjectId ( ) ,
46+ "_id" : mongoose . Types . ObjectId . createFromTime ( 3 ) ,
4747 "name" : Constants . General . VOLUNTEER ,
4848 "routes" : [
4949 Constants . Routes . volunteerRoutes . post ,
@@ -54,7 +54,7 @@ const volunteerRole = {
5454} ;
5555
5656const sponsorT1Role = {
57- "_id" : mongoose . Types . ObjectId ( ) ,
57+ "_id" : mongoose . Types . ObjectId . createFromTime ( 4 ) ,
5858 "name" : Constants . General . SPONSOR_T1 ,
5959 "routes" : [
6060 Constants . Routes . sponsorRoutes . post ,
@@ -63,7 +63,7 @@ const sponsorT1Role = {
6363} ;
6464
6565const sponsorT2Role = {
66- "_id" : mongoose . Types . ObjectId ( ) ,
66+ "_id" : mongoose . Types . ObjectId . createFromTime ( 5 ) ,
6767 "name" : Constants . General . SPONSOR_T2 ,
6868 "routes" : [
6969 Constants . Routes . sponsorRoutes . post ,
@@ -72,7 +72,7 @@ const sponsorT2Role = {
7272} ;
7373
7474const sponsorT3Role = {
75- "_id" : mongoose . Types . ObjectId ( ) ,
75+ "_id" : mongoose . Types . ObjectId . createFromTime ( 6 ) ,
7676 "name" : Constants . General . SPONSOR_T3 ,
7777 "routes" : [
7878 Constants . Routes . sponsorRoutes . post ,
@@ -81,7 +81,7 @@ const sponsorT3Role = {
8181} ;
8282
8383const sponsorT4Role = {
84- "_id" : mongoose . Types . ObjectId ( ) ,
84+ "_id" : mongoose . Types . ObjectId . createFromTime ( 7 ) ,
8585 "name" : Constants . General . SPONSOR_T4 ,
8686 "routes" : [
8787 Constants . Routes . sponsorRoutes . post ,
@@ -90,7 +90,7 @@ const sponsorT4Role = {
9090} ;
9191
9292const sponsorT5Role = {
93- "_id" : mongoose . Types . ObjectId ( ) ,
93+ "_id" : mongoose . Types . ObjectId . createFromTime ( 8 ) ,
9494 "name" : Constants . General . SPONSOR_T5 ,
9595 "routes" : [
9696 Constants . Routes . sponsorRoutes . post ,
@@ -110,6 +110,8 @@ function createAllSingularRoles() {
110110 const allRoutes = Constants . Routes . allRoutes ;
111111 let roles = [ ] ;
112112
113+ // i is unique integer so that objectId is constant
114+ var i = 1000000 ;
113115 for ( let routeGroupKey in allRoutes ) {
114116
115117 if ( ! allRoutes . hasOwnProperty ( routeGroupKey ) ) {
@@ -123,12 +125,13 @@ function createAllSingularRoles() {
123125 }
124126
125127 let role = {
126- _id : mongoose . Types . ObjectId ( ) ,
128+ _id : mongoose . Types . ObjectId ( i ) ,
127129 name : routeKey + routeGroupKey ,
128130 routes : routeGroup [ routeKey ] ,
129131 } ;
130132 let roleName = role . name ;
131133 roles [ roleName ] = role ;
134+ i -= 1 ;
132135 }
133136 }
134137
0 commit comments