Skip to content

Commit

Permalink
Fix: Remove unused BikeRegistration.init, clarify code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aokj4ck committed Jan 24, 2025
1 parent 9b46e33 commit 8c21bd4
Showing 1 changed file with 2 additions and 35 deletions.
37 changes: 2 additions & 35 deletions BikeIndex/Model/Registering/BikeRegistration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,39 +56,6 @@ struct BikeRegistration: Encodable {
var stolen_record: StolenRecord?
var components: [Component]?

init(serial: String?, manufacturer: String, owner_email: String, primary_frame_color: FrameColor, owner_email_is_phone_number: Bool? = nil, organization_slug: String? = nil, cycle_type_name: BicycleType? = nil, no_duplicate: Bool? = nil, rear_wheel_bsd: Int? = nil, rear_tire_narrow: Bool? = nil, front_wheel_bsd: String? = nil, front_tire_narrow: Bool? = nil, frame_model: String? = nil, year: UInt? = nil, description: String? = nil, secondary_frame_color: FrameColor? = nil, tertiary_frame_color: FrameColor? = nil, rear_gear_type_slug: String? = nil, front_gear_type_slug: String? = nil, extra_registration_number: String? = nil, handlebar_type_slug: String? = nil, no_notify: Bool? = nil, is_for_sale: Bool? = nil, frame_material: String, external_image_urls: [URL]? = nil, bike_sticker: String? = nil, propulsion: Propulsion? = nil, stolen_record: StolenRecord? = nil, components: [Component]? = nil) {
self.serial = serial ?? Serial.unknown
self.manufacturer = manufacturer
self.owner_email = owner_email
self.primary_frame_color = primary_frame_color.rawValue.lowercased()
self.color = primary_frame_color.rawValue.lowercased()
self.owner_email_is_phone_number = owner_email_is_phone_number
self.organization_slug = organization_slug
self.cycle_type_name = cycle_type_name
self.no_duplicate = no_duplicate
self.rear_wheel_bsd = rear_wheel_bsd
self.rear_tire_narrow = rear_tire_narrow
self.front_wheel_bsd = front_wheel_bsd
self.front_tire_narrow = front_tire_narrow
self.frame_model = frame_model
self.year = year
self.description = description
self.secondary_frame_color = secondary_frame_color?.rawValue.lowercased()
self.tertiary_frame_color = tertiary_frame_color?.rawValue.lowercased()
self.rear_gear_type_slug = rear_gear_type_slug
self.front_gear_type_slug = front_gear_type_slug
self.extra_registration_number = extra_registration_number
self.handlebar_type_slug = handlebar_type_slug
self.no_notify = no_notify
self.is_for_sale = is_for_sale
self.frame_material = frame_material
self.external_image_urls = external_image_urls
self.bike_sticker = bike_sticker
self.propulsion = propulsion
self.stolen_record = stolen_record
self.components = components
}

init(bike: Bike,
mode: RegisterMode,
stolen: StolenRecord?,
Expand All @@ -102,7 +69,7 @@ struct BikeRegistration: Encodable {
self.manufacturer = bike.manufacturerName
self.primary_frame_color = bike.frameColorPrimary.rawValue.lowercased()
self.color = bike.frameColorPrimary.rawValue.lowercased()
self.owner_email = ownerEmail // Bike<->User relationships are not yet established
self.owner_email = ownerEmail

// Non-required fields
self.secondary_frame_color = bike.frameColorSecondary?.rawValue.lowercased()
Expand All @@ -122,7 +89,7 @@ struct BikeRegistration: Encodable {
self.stolen_record = nil
}

// Unsupported fields for future work
// TODO: Unsupported fields, support in future changes
self.owner_email_is_phone_number = nil
self.organization_slug = nil
self.no_duplicate = nil
Expand Down

0 comments on commit 8c21bd4

Please sign in to comment.