-
Notifications
You must be signed in to change notification settings - Fork 0
/
User.m
57 lines (48 loc) · 1.34 KB
/
User.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// User.m
// Headshot-ios
//
// Created by Charlie White on 5/23/14.
// Copyright (c) 2014 Charlie White. All rights reserved.
//
#import "User.h"
#import "Company.h"
#import "EmployeeInfo.h"
@implementation User
@dynamic account;
@dynamic identifier;
@dynamic firstName;
@dynamic lastName;
@dynamic fullName;
@dynamic installedApp;
@dynamic sharingOfficeLocation;
@dynamic archived;
@dynamic email;
@dynamic avatarFaceUrl;
@dynamic avatarFace2xUrl;
@dynamic avatarUrl;
@dynamic employeeInfo;
@dynamic company;
@dynamic department;
@dynamic currentOfficeLocation;
@dynamic manager;
@dynamic subordinates;
@dynamic messageThreads;
+ (void)initialize
{
[self registerCRUDBaseURL:[NSURL URLWithString:@"users"]];
}
+ (void)usersWithCompletionHandler:(void(^)(NSArray *users, NSError *error))completionHandler {
NSURL *URL = [NSURL URLWithString:@"users.json"];
[self fetchObjectsFromURL:URL completionHandler:completionHandler];
}
+ (NSArray *)findAllExcludeCurrent
{
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"identifier != %@ && archived == NO", [AppDelegate sharedDelegate].store.currentAccount.identifier];
return [User MR_findAllWithPredicate:predicate];
}
- (NSString *)nameInitials
{
return [NSString stringWithFormat:@"%@%@", [self.firstName substringToIndex:1], [self.lastName substringToIndex:1]];
}
@end