Skip to content

Commit 1819a87

Browse files
dotansimhadarkbasic
authored andcommitted
Step 13.35: Update creation of users stubs
1 parent b6f23f7 commit 1819a87

File tree

1 file changed

+37
-5
lines changed

1 file changed

+37
-5
lines changed

api/server/main.ts

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Meteor } from 'meteor/meteor';
2+
import { Picture } from './models';
23
import { Accounts } from 'meteor/accounts-base';
34
import { Users } from './collections/users';
45

@@ -12,43 +13,74 @@ Meteor.startup(() => {
1213
return;
1314
}
1415

16+
let picture = importPictureFromUrl({
17+
name: 'man1.jpg',
18+
url: 'https://randomuser.me/api/portraits/men/1.jpg'
19+
});
20+
1521
Accounts.createUserWithPhone({
1622
phone: '+972540000001',
1723
profile: {
1824
name: 'Ethan Gonzalez',
19-
picture: 'https://randomuser.me/api/portraits/men/1.jpg'
25+
pictureId: picture._id
2026
}
2127
});
2228

29+
picture = importPictureFromUrl({
30+
name: 'lego1.jpg',
31+
url: 'https://randomuser.me/api/portraits/lego/1.jpg'
32+
});
33+
2334
Accounts.createUserWithPhone({
2435
phone: '+972540000002',
2536
profile: {
2637
name: 'Bryan Wallace',
27-
picture: 'https://randomuser.me/api/portraits/lego/1.jpg'
38+
pictureId: picture._id
2839
}
2940
});
3041

42+
picture = importPictureFromUrl({
43+
name: 'woman1.jpg',
44+
url: 'https://randomuser.me/api/portraits/women/1.jpg'
45+
});
46+
3147
Accounts.createUserWithPhone({
3248
phone: '+972540000003',
3349
profile: {
3450
name: 'Avery Stewart',
35-
picture: 'https://randomuser.me/api/portraits/women/1.jpg'
51+
pictureId: picture._id
3652
}
3753
});
3854

55+
picture = importPictureFromUrl({
56+
name: 'woman2.jpg',
57+
url: 'https://randomuser.me/api/portraits/women/2.jpg'
58+
});
59+
3960
Accounts.createUserWithPhone({
4061
phone: '+972540000004',
4162
profile: {
4263
name: 'Katie Peterson',
43-
picture: 'https://randomuser.me/api/portraits/women/2.jpg'
64+
pictureId: picture._id
4465
}
4566
});
4667

68+
picture = importPictureFromUrl({
69+
name: 'man2.jpg',
70+
url: 'https://randomuser.me/api/portraits/men/2.jpg'
71+
});
72+
4773
Accounts.createUserWithPhone({
4874
phone: '+972540000005',
4975
profile: {
5076
name: 'Ray Edwards',
51-
picture: 'https://randomuser.me/api/portraits/men/2.jpg'
77+
pictureId: picture._id
5278
}
5379
});
5480
});
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)