Skip to content

Commit 794c94c

Browse files
committed
Step 15.7: Removing db initialization in main.ts
1 parent 3c6d022 commit 794c94c

File tree

1 file changed

+0
-77
lines changed

1 file changed

+0
-77
lines changed

api/server/main.ts

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,9 @@
11
import { Meteor } from 'meteor/meteor';
2-
import { Picture } from './models';
32
import { Accounts } from 'meteor/accounts-base';
4-
import { Users } from './collections/users';
53

64
Meteor.startup(() => {
75
if (Meteor.settings) {
86
Object.assign(Accounts._options, Meteor.settings['accounts-phone']);
97
SMS.twilio = Meteor.settings['twilio'];
108
}
11-
12-
if (Users.collection.find().count() > 0) {
13-
return;
14-
}
15-
16-
let picture = importPictureFromUrl({
17-
name: 'man1.jpg',
18-
url: 'https://randomuser.me/api/portraits/men/1.jpg'
19-
});
20-
21-
Accounts.createUserWithPhone({
22-
phone: '+972540000001',
23-
profile: {
24-
name: 'Ethan Gonzalez',
25-
pictureId: picture._id
26-
}
27-
});
28-
29-
picture = importPictureFromUrl({
30-
name: 'lego1.jpg',
31-
url: 'https://randomuser.me/api/portraits/lego/1.jpg'
32-
});
33-
34-
Accounts.createUserWithPhone({
35-
phone: '+972540000002',
36-
profile: {
37-
name: 'Bryan Wallace',
38-
pictureId: picture._id
39-
}
40-
});
41-
42-
picture = importPictureFromUrl({
43-
name: 'woman1.jpg',
44-
url: 'https://randomuser.me/api/portraits/women/1.jpg'
45-
});
46-
47-
Accounts.createUserWithPhone({
48-
phone: '+972540000003',
49-
profile: {
50-
name: 'Avery Stewart',
51-
pictureId: picture._id
52-
}
53-
});
54-
55-
picture = importPictureFromUrl({
56-
name: 'woman2.jpg',
57-
url: 'https://randomuser.me/api/portraits/women/2.jpg'
58-
});
59-
60-
Accounts.createUserWithPhone({
61-
phone: '+972540000004',
62-
profile: {
63-
name: 'Katie Peterson',
64-
pictureId: picture._id
65-
}
66-
});
67-
68-
picture = importPictureFromUrl({
69-
name: 'man2.jpg',
70-
url: 'https://randomuser.me/api/portraits/men/2.jpg'
71-
});
72-
73-
Accounts.createUserWithPhone({
74-
phone: '+972540000005',
75-
profile: {
76-
name: 'Ray Edwards',
77-
pictureId: picture._id
78-
}
79-
});
809
});
81-
82-
function importPictureFromUrl(options: { name: string, url: string }): Picture {
83-
const description = { name: options.name };
84-
85-
return Meteor.call('ufsImportURL', options.url, description, 'pictures');
86-
}

0 commit comments

Comments
 (0)