#import "ObjectHelper.h" NS_ASSUME_NONNULL_BEGIN @implementation ObjectHelper #pragma mark - SQL Results to QSObjects + (QSObject *) areaFromSQLResult:(NSDictionary *)result usingPath:(NSString *)path { NSMutableDictionary *configuration = [result mutableCopy]; [configuration setObject:path forKey:@"path"]; QSObject *area = [QSObject makeObjectWithIdentifier:[result objectForKey:@"uuid"]]; [area setObject:configuration forType:kAreaType]; [area setName:[result objectForKey:@"title"]]; [area setPrimaryType:kAreaType]; return area; } + (QSObject *) projectFromSQLResult:(NSDictionary *)result usingPath:(NSString *)path { NSMutableDictionary *configuration = [result mutableCopy]; [configuration setObject:path forKey:@"path"]; QSObject *project = [QSObject makeObjectWithIdentifier:[result objectForKey:@"uuid"]]; [project setObject:configuration forType:kProjectType]; [project setName:[result objectForKey:@"title"]]; [project setDetails:[result objectForKey:@"notes"]]; [project setPrimaryType:kProjectType]; return project; } + (QSObject *) taskFromSQLResult:(NSDictionary *)result usingPath:(NSString *)path { NSMutableDictionary *configuration = [result mutableCopy]; [configuration setObject:path forKey:@"path"]; QSObject *task = [QSObject makeObjectWithIdentifier:[result objectForKey:@"uuid"]]; [task setObject:configuration forType:kTaskType]; [task setName:[result objectForKey:@"title"]]; [task setDetails:[result objectForKey:@"notes"]]; [task setPrimaryType:kTaskType]; return task; } + (QSObject *) tagFromSQLResult:(NSDictionary *)result usingPath:(NSString *)path { NSMutableDictionary *configuration = [result mutableCopy]; [configuration setObject:path forKey:@"path"]; QSObject *tag = [QSObject makeObjectWithIdentifier:[result objectForKey:@"uuid"]]; [tag setObject:configuration forType:kTagType]; [tag setName:[result objectForKey:@"title"]]; [tag setPrimaryType:kTagType]; return tag; } @end NS_ASSUME_NONNULL_END