File tree 2 files changed +13
-11
lines changed
2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -2,27 +2,29 @@ const database = require('../dist/database');
2
2
const { NEXAccount } = require ( '../dist/models/nex-account' ) ;
3
3
4
4
database . connect ( ) . then ( async function ( ) {
5
- const nexAccounts = await NEXAccount . find ( { } ) ;
5
+ const nexAccountsTotal = await NEXAccount . find ( { } ) ;
6
6
const nexAccounts3DS = await NEXAccount . find ( { device_type : '3ds' } ) ;
7
7
const nexAccountsWiiU = await NEXAccount . find ( { device_type : 'wiiu' } ) ;
8
+ const nexAccountsToBeChanged = await NEXAccount . find ( {
9
+ device_type : {
10
+ $exists : false
11
+ }
12
+ } ) ;
8
13
9
- console . log ( 'NEX accounts:' , nexAccounts . length ) ;
14
+ console . log ( 'NEX accounts (Total) :' , nexAccountsTotal . length ) ;
10
15
console . log ( 'NEX accounts (3DS):' , nexAccounts3DS . length ) ;
11
16
console . log ( 'NEX accounts (WiiU):' , nexAccountsWiiU . length ) ;
17
+ console . log ( 'NEX accounts (To be changed):' , nexAccountsToBeChanged . length ) ;
12
18
13
- for ( const nexAccount of nexAccounts ) {
14
- let deviceType = '' ;
15
-
19
+ for ( const nexAccount of nexAccountsToBeChanged ) {
16
20
if ( nexAccount . owning_pid !== nexAccount . pid ) {
17
21
// 3DS account
18
- deviceType = '3ds' ;
22
+ nexAccount . device_type = '3ds' ;
19
23
} else {
20
24
// WiiU account
21
- deviceType = 'wiiu' ;
25
+ nexAccount . device_type = 'wiiu' ;
22
26
}
23
27
24
- nexAccount . device_type = deviceType ;
25
-
26
28
await nexAccount . save ( ) ;
27
29
}
28
30
Original file line number Diff line number Diff line change @@ -3,14 +3,14 @@ const database = require('../dist/database');
3
3
const { NEXAccount } = require ( '../dist/models/nex-account' ) ;
4
4
5
5
database . connect ( ) . then ( async function ( ) {
6
- const nexAccounts3DS = await NEXAccount . find ( {
6
+ const nexAccountsToBeChanged = await NEXAccount . find ( {
7
7
device_type : '3ds' ,
8
8
friend_code : {
9
9
$exists : false
10
10
}
11
11
} ) ;
12
12
13
- for ( const nexAccount of nexAccounts3DS ) {
13
+ for ( const nexAccount of nexAccountsToBeChanged ) {
14
14
15
15
if ( ! nexAccount . friend_code ) {
16
16
const pid = nexAccount . pid ;
You can’t perform that action at this time.
0 commit comments