88} from '../../repositories' ;
99import { Place } from '../../types/models' ;
1010import * as console from 'console' ;
11- import { includes } from 'lodash' ;
11+ import { includes } from 'lodash' ;
1212
1313/** Service for dealing with colony */
1414@Service ( )
@@ -18,16 +18,16 @@ export class ColonyService {
1818 private roleAssignmentRepository : RoleAssignmentRepository ,
1919 private roleRepository : RoleRepository ,
2020 private memberRepository : MemberRepository ,
21- ) { }
22-
21+ ) { }
22+
2323 public async find ( colonyId : number ) : Promise < Place > {
2424 return await this . colonyRepository . find ( colonyId ) ;
2525 }
2626
2727 public async getHoods ( colonyId : number ) : Promise < any > {
2828 return await this . colonyRepository . getHoods ( colonyId ) ;
2929 }
30-
30+
3131 public async getAccessInfoByUsername ( colonyId : number ) : Promise < object > {
3232 const deputyCode = await this . roleRepository . roleMap . ColonyDeputy ;
3333 const ownerCode = await this . roleRepository . roleMap . ColonyLeader ;
@@ -50,8 +50,8 @@ export class ColonyService {
5050 const ownerCode = await this . roleRepository . roleMap . ColonyLeader ;
5151 let oldOwner = null ;
5252 let newOwner = 0 ;
53- const oldDeputies = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
54- const newDeputies = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
53+ const oldDeputies = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
54+ const newDeputies = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
5555 const data = await this
5656 . roleAssignmentRepository
5757 . getAccessInfoByID ( colonyId , ownerCode , deputyCode ) ;
@@ -72,8 +72,8 @@ export class ColonyService {
7272 const response : any = await this . memberRepository . getPrimaryRoleName ( oldOwner ) ;
7373 if ( response . length !== 0 ) {
7474 const primaryRoleId = response [ 0 ] . primary_role_id ;
75- if ( ownerCode === primaryRoleId ) {
76- await this . memberRepository . update ( oldOwner , { primary_role_id : null } ) ;
75+ if ( ownerCode === primaryRoleId ) {
76+ await this . memberRepository . update ( oldOwner , { primary_role_id : null } ) ;
7777 }
7878 }
7979 }
@@ -84,8 +84,8 @@ export class ColonyService {
8484 const response : any = await this . memberRepository . getPrimaryRoleName ( oldOwner ) ;
8585 if ( response . length !== 0 ) {
8686 const primaryRoleId = response [ 0 ] . primary_role_id ;
87- if ( ownerCode === primaryRoleId ) {
88- await this . memberRepository . update ( oldOwner , { primary_role_id : null } ) ;
87+ if ( ownerCode === primaryRoleId ) {
88+ await this . memberRepository . update ( oldOwner , { primary_role_id : null } ) ;
8989 }
9090 }
9191 }
@@ -110,7 +110,7 @@ export class ColonyService {
110110 if ( response . length !== 0 ) {
111111 const primaryRoleId = response [ 0 ] . primary_role_id ;
112112 if ( primaryRoleId && deputyCode === primaryRoleId ) {
113- this . memberRepository . update ( oldDeputies , { primary_role_id : null } ) ;
113+ this . memberRepository . update ( oldDeputies , { primary_role_id : null } ) ;
114114 }
115115 }
116116 } ) ;
@@ -123,7 +123,7 @@ export class ColonyService {
123123 if ( response . length !== 0 ) {
124124 const primaryRoleId = response [ 0 ] . primary_role_id ;
125125 if ( deputyCode === primaryRoleId ) {
126- this . memberRepository . update ( oldDeputies , { primary_role_id : null } ) ;
126+ this . memberRepository . update ( oldDeputies , { primary_role_id : null } ) ;
127127 }
128128 }
129129 } ) ;
@@ -146,8 +146,6 @@ export class ColonyService {
146146 return (
147147 [
148148 this . roleRepository . roleMap . Admin ,
149- this . roleRepository . roleMap . CityMayor ,
150- this . roleRepository . roleMap . DeputyMayor ,
151149 this . roleRepository . roleMap . ColonyRepresentative ,
152150 ] . includes ( assignment . role_id ) ||
153151 ( [
0 commit comments