Skip to content

Commit

Permalink
Committing 2023 Code to Master, iOS app version 2023.2.0 (#530)
Browse files Browse the repository at this point in the history
  • Loading branch information
lasyaneti authored Jul 18, 2023
1 parent 88b3783 commit 849da8b
Show file tree
Hide file tree
Showing 567 changed files with 6,833 additions and 771 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# codeowners' reviews are required before merging

* @PatrickKan @jeffkim2001 @ashayp22
* @jeffkim2001 @ashayp22 @lasyaneti

1 change: 1 addition & 0 deletions HIAPI/Models/Attendee.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ public struct Attendee: Codable, APIReturnable {
public let school: String
public let major: String
public let gender: String
public let dietary: [String]?
}
41 changes: 41 additions & 0 deletions HIAPI/Models/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,47 @@ public struct EventContainer: Decodable, APIReturnable {
}
}

public struct StaffEventContainer: Decodable, APIReturnable {
public let events: [StaffEvent]

public init(from data: Data) throws {
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .secondsSince1970
self = try decoder.decode(StaffEventContainer.self, from: data)
}
}

public struct StaffEvent: Codable {
internal enum CodingKeys: String, CodingKey {
case id
case endTime
case eventType
case info = "description"
case locations
case name
case sponsor
case startTime
case points
case isAsync
case isPrivate
case displayOnStaffCheckin
}

public var id: String
public let endTime: Date
public let eventType: String
public let info: String
public let locations: [Location]
public let name: String
public let sponsor: String
public let startTime: Date
public let points: Int
public let isAsync: Bool
public let isPrivate: Bool
public let displayOnStaffCheckin: Bool
}


public struct Event: Codable {
internal enum CodingKeys: String, CodingKey {
case id
Expand Down
4 changes: 2 additions & 2 deletions HIAPI/Models/Profile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public struct Profile: Codable, APIReturnable {
case firstName
case lastName
case points
case timezone
case foodWave
case discord
case avatarUrl
}
Expand All @@ -38,7 +38,7 @@ public struct Profile: Codable, APIReturnable {
public let firstName: String
public let lastName: String
public let points: Int
public let timezone: String
public let foodWave: Int
public let discord: String
public let avatarUrl: String
}
Expand Down
7 changes: 6 additions & 1 deletion HIAPI/Models/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public struct RolesContainer: Codable, APIReturnable {
public struct Roles: OptionSet, Codable {
public let rawValue: Int

public static let null = Roles(rawValue: 0)
public static let null = Roles([])
public static let user = Roles(rawValue: 1 << 0)
public static let applicant = Roles(rawValue: 1 << 1)
public static let attendee = Roles(rawValue: 1 << 2)
Expand Down Expand Up @@ -93,6 +93,11 @@ fileprivate extension Optional where Wrapped == String {
}
}

public struct QRData: Codable, APIReturnable {
public let id: String
public let qrInfo: String
}

public struct DietaryRestrictions: OptionSet, Codable, APIReturnable {
public let rawValue: Int

Expand Down
13 changes: 13 additions & 0 deletions HIAPI/Services/EventService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ public class EventService: BaseService {
return APIRequest<EventCheckInStatus>(service: self, endpoint: "checkin/", body: body, method: .POST)
}

public static func staffCheckIn(userToken: String, eventId: String) -> APIRequest<EventCheckInStatus> {
var body = HTTPBody()
body["userToken"] = userToken
body["eventId"] = eventId
return APIRequest<EventCheckInStatus>(service: self, endpoint: "staff/checkin/", body: body, method: .POST)
}

public static func getStaffCheckInEvents(authToken: String) -> APIRequest<StaffEventContainer> {
var header = HTTPHeaders()
header["Authorization"] = authToken
return APIRequest<StaffEventContainer>(service: self, endpoint: "filter/?displayOnStaffCheckin=true", headers: header, method: .GET)
}

public static func create(event: Event) -> APIRequest<EventContainer> {
let eventDict = [String: Any]()
assert(false)
Expand Down
5 changes: 5 additions & 0 deletions HIAPI/Services/RegistrationService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ public final class RegistrationService: BaseService {
public static func getAttendee() -> APIRequest<AttendeeContainer> {
return APIRequest<AttendeeContainer>(service: self, endpoint: "", method: .GET)
}

public static func getAttendeeRegistrationUserID(userID: String) -> APIRequest<Attendee> {

return APIRequest<Attendee>(service: self, endpoint: "attendee/" + userID + "/", method: .GET)
}
}
4 changes: 4 additions & 0 deletions HIAPI/Services/UserService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ public final class UserService: BaseService {
public static func getUser() -> APIRequest<User> {
return APIRequest<User>(service: self, endpoint: "", headers: headers, method: .GET)
}

public static func getQR() -> APIRequest<QRData> {
return APIRequest<QRData>(service: self, endpoint: "qr/", method: .GET)
}
}
Loading

0 comments on commit 849da8b

Please sign in to comment.