diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-09-12 21:50:40 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-09-12 21:50:40 +0200 |
| commit | 182872c760d437556d606cc02c6b7c570667a715 (patch) | |
| tree | 11795bdb259445e5c3f8dd0177e9426ec77b0399 /QSThingsPlugin/Helpers/ObjectHelper.m | |
| parent | 5870e5cf03ceaff7080174b573618631a413110e (diff) | |
Add children
Diffstat (limited to 'QSThingsPlugin/Helpers/ObjectHelper.m')
| -rw-r--r-- | QSThingsPlugin/Helpers/ObjectHelper.m | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/QSThingsPlugin/Helpers/ObjectHelper.m b/QSThingsPlugin/Helpers/ObjectHelper.m new file mode 100644 index 0000000..cf26127 --- /dev/null +++ b/QSThingsPlugin/Helpers/ObjectHelper.m @@ -0,0 +1,58 @@ +#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 |