Skip to content

Commit a28cffd

Browse files
committed
Code refactoring
1 parent 9ad9768 commit a28cffd

3 files changed

Lines changed: 4 additions & 6 deletions

File tree

Package.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ let package = Package(
2424
.package(url: "https://github.com/pointfreeco/swift-parsing", revision: "0.9.2"),
2525
.package(url: "https://github.com/pointfreeco/swift-url-routing", from: "0.1.0"),
2626
.package(url: "https://github.com/pointfreeco/vapor-routing", from: "0.1.0"),
27-
// .package(url: "https://github.com/google/swift-benchmark", from: "0.1.1"),
2827
],
2928
targets: [
3029
.target(

Sources/App/Controllers/LessonsController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// File.swift
2+
// LessonsController.swift
33
//
44
//
55
// Created by Denys Danyliuk on 27.05.2022.
@@ -10,9 +10,9 @@ import KPIHubParser
1010

1111
final class LessonsController {
1212

13-
func getGroups(for uuid: UUID, request: Request) async throws -> LessonsResponse {
13+
func getLessons(for groupUUID: UUID, request: Request) async throws -> LessonsResponse {
1414
let response = try await request.client.get(
15-
"http://rozklad.kpi.ua/Schedules/ViewSchedule.aspx?g=\(uuid.uuidString)"
15+
"http://rozklad.kpi.ua/Schedules/ViewSchedule.aspx?g=\(groupUUID.uuidString)"
1616
)
1717
let html = try (response.body).htmlString(encoding: .utf8)
1818
let lessons = try LessonsParser().parse(html)

Sources/App/routes.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ func apiHandler(
2727
case let .campus(route):
2828
return try await campusHandler(request: request, route: route)
2929

30-
3130
case let .groups(route):
3231
return try await groupsHandler(request: request, route: route)
3332

@@ -84,6 +83,6 @@ func groupHandler(
8483
switch route {
8584
case .lessons:
8685
let controller = LessonsController()
87-
return try await controller.getGroups(for: uuid, request: request)
86+
return try await controller.getLessons(for: uuid, request: request)
8887
}
8988
}

0 commit comments

Comments
 (0)