From 2945c672d3709ecaa619558d022c5ecacb77a3e3 Mon Sep 17 00:00:00 2001 From: Dev Patel <63603475+Patle1234@users.noreply.github.com> Date: Wed, 7 Feb 2024 20:18:07 -0600 Subject: [PATCH 1/2] Create Staff.swift --- HIAPI/Models/Staff.swift | 66 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 HIAPI/Models/Staff.swift diff --git a/HIAPI/Models/Staff.swift b/HIAPI/Models/Staff.swift new file mode 100644 index 00000000..0088e0f9 --- /dev/null +++ b/HIAPI/Models/Staff.swift @@ -0,0 +1,66 @@ +// +// Staff.swift +// HIAPI +// +// Created by Dev Patel on 2/7/24. +// Copyright © 2024 HackIllinois. All rights reserved. +// +import Foundation +import APIManager + +public struct StaffContainer: Decodable, APIReturnable { + public let shifts: [Staff] +// public init(from decoder: Decoder) throws { +// let container = try decoder.singleValueContainer() +// self.items = try container.decode([Staff].self) +// } +} + +public struct Staff: Codable { + internal enum CodingKeys: String, CodingKey { + case isPro + case eventId + case isStaff + case name + case description + case startTime + case endTime + case eventType + case exp + case locations + case isAsync + case mapImageUrl + case points + case isPrivate + case displayOnStaffCheckIn + } + public let isPro: String + public let eventId: String + public let isStaff: Bool + public let name: Int + public let description: String + public let startTime: Date + public let endTime: Date + public let eventType: String + public let exp: Int + public let locations: [Location] + public let isAsync: Bool + public let mapImageUrl: String + public let points: Int + public let isPrivate: Bool + public let displayOnStaffCheckIn: Bool + + +} + +public struct UserAttendanceContainer: Codable, APIReturnable { + internal enum CodingKeys: String, CodingKey { + case sucess + } + public let sucess: Bool +} + +public struct StaffAttendanceContainer: Codable, APIReturnable { + +} + From 68a7dec42bc919c925275079724d161df3274843 Mon Sep 17 00:00:00 2001 From: Dev Patel <63603475+Patle1234@users.noreply.github.com> Date: Wed, 7 Feb 2024 20:18:48 -0600 Subject: [PATCH 2/2] Create StaffService.swift --- HIAPI/Services/StaffService.swift | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 HIAPI/Services/StaffService.swift diff --git a/HIAPI/Services/StaffService.swift b/HIAPI/Services/StaffService.swift new file mode 100644 index 00000000..84c231d7 --- /dev/null +++ b/HIAPI/Services/StaffService.swift @@ -0,0 +1,34 @@ +// +// StaffService.swift +// HIAPI +// +// Created by Dev Patel on 2/7/24. +// Copyright © 2024 HackIllinois. All rights reserved. +// + +import Foundation +import APIManager + +public final class StaffService: BaseService { + public override static var baseURL: String { + return super.baseURL + "staff/" + } + + public static func getStaffShift(userToken: String) -> APIRequest { + var headers = HTTPHeaders() + headers["Authorization"] = userToken + return APIRequest(service: self, endpoint: "shift/", headers: headers, method: .GET) + } + + public static func recordStaffAttendance(userToken: String) -> APIRequest { + var headers = HTTPHeaders() + headers["Authorization"] = userToken + return APIRequest(service: self, endpoint: "attendance/", headers: headers, method: .POST) + } + + public static func recordUserAttendance(userToken: String) -> APIRequest { + var headers = HTTPHeaders() + headers["Authorization"] = userToken + return APIRequest(service: self, endpoint: "scan-attendee/", headers: headers, method: .PUT) + } +}