diff --git a/Package.swift b/Package.swift index c3750bc..68ed5df 100644 --- a/Package.swift +++ b/Package.swift @@ -11,7 +11,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/apple/swift-async-algorithms.git", from: "1.0.0"), - .package(url: "https://github.com/hummingbird-project/hummingbird.git", branch: "2.x.x"), + .package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.0.0-alpha.1"), .package(url: "https://github.com/vapor/fluent-kit.git", from: "1.45.1"), .package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.0.0"), // used in tests @@ -29,7 +29,6 @@ let package = Package( .product(name: "FluentSQLiteDriver", package: "fluent-sqlite-driver"), .product(name: "FluentPostgresDriver", package: "fluent-postgres-driver"), .byName(name: "HummingbirdFluent"), - .product(name: "HummingbirdFoundation", package: "hummingbird"), .product(name: "HummingbirdXCT", package: "hummingbird"), ]), ] diff --git a/Sources/HummingbirdFluent/Fluent.swift b/Sources/HummingbirdFluent/Fluent.swift index 106f99c..addf8ef 100644 --- a/Sources/HummingbirdFluent/Fluent.swift +++ b/Sources/HummingbirdFluent/Fluent.swift @@ -2,7 +2,7 @@ // // This source file is part of the Hummingbird server framework project // -// Copyright (c) 2021-2023 the Hummingbird authors +// Copyright (c) 2021-2024 the Hummingbird authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information diff --git a/Sources/HummingbirdFluent/Persist+fluent.swift b/Sources/HummingbirdFluent/Persist+fluent.swift index e463c86..b72b95b 100644 --- a/Sources/HummingbirdFluent/Persist+fluent.swift +++ b/Sources/HummingbirdFluent/Persist+fluent.swift @@ -2,7 +2,7 @@ // // This source file is part of the Hummingbird server framework project // -// Copyright (c) 2021-2021 the Hummingbird authors +// Copyright (c) 2021-2024 the Hummingbird authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information diff --git a/Sources/HummingbirdFluent/UUID.swift b/Sources/HummingbirdFluent/UUID.swift deleted file mode 100644 index 27973f0..0000000 --- a/Sources/HummingbirdFluent/UUID.swift +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Hummingbird server framework project -// -// Copyright (c) 2021-2021 the Hummingbird authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -import Foundation - -extension UUID: LosslessStringConvertible { - public init?(_ description: String) { - self.init(uuidString: description) - } -} diff --git a/Tests/HummingbirdFluentTests/FluentTests.swift b/Tests/HummingbirdFluentTests/FluentTests.swift index b21c543..15d3b59 100644 --- a/Tests/HummingbirdFluentTests/FluentTests.swift +++ b/Tests/HummingbirdFluentTests/FluentTests.swift @@ -2,7 +2,7 @@ // // This source file is part of the Hummingbird server framework project // -// Copyright (c) 2021-2021 the Hummingbird authors +// Copyright (c) 2021-2024 the Hummingbird authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information @@ -73,16 +73,27 @@ final class FluentTests: XCTestCase { ) // add sqlite database fluent.databases.use(.sqlite(.memory), as: .sqlite) - // fluent.databases.use(.postgres(hostname: "localhost", username: "postgres", password: "vapor", database: "vapor"), as: .psql) + /* fluent.databases.use( + .postgres( + configuration: .init( + hostname: "localhost", + port: 5432, + username: "hummingbird", + password: "hummingbird", + database: "hummingbird", tls: .disable + ), + maxConnectionsPerEventLoop: 32 + ), + as: .psql + ) */ // add migration await fluent.migrations.add(CreatePlanet()) // run migrations try await fluent.migrate() let router = HBRouter() - router.middlewares.add(HBSetCodableMiddleware(decoder: JSONDecoder(), encoder: JSONEncoder())) router.put("planet") { request, context in - let planet = try await request.decode(as: Planet.self, using: context) + let planet = try await request.decode(as: Planet.self, context: context) try await planet.create(on: fluent.db()) return CreateResponse(id: planet.id!) } diff --git a/Tests/HummingbirdFluentTests/PersistTests.swift b/Tests/HummingbirdFluentTests/PersistTests.swift index 4705cf3..0bf6b5c 100644 --- a/Tests/HummingbirdFluentTests/PersistTests.swift +++ b/Tests/HummingbirdFluentTests/PersistTests.swift @@ -2,7 +2,7 @@ // // This source file is part of the Hummingbird server framework project // -// Copyright (c) 2021-2021 the Hummingbird authors +// Copyright (c) 2021-2024 the Hummingbird authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information @@ -24,20 +24,20 @@ final class PersistTests: XCTestCase { logger.logLevel = .trace let fluent = HBFluent(logger: logger) // add sqlite database - // fluent.databases.use(.sqlite(.memory), as: .sqlite) - fluent.databases.use( - .postgres( - configuration: .init( - hostname: "localhost", - port: 5432, - username: "hummingbird", - password: "hummingbird", - database: "hummingbird", tls: .disable - ), - maxConnectionsPerEventLoop: 32 - ), - as: .psql - ) + fluent.databases.use(.sqlite(.memory), as: .sqlite) + /* fluent.databases.use( + .postgres( + configuration: .init( + hostname: "localhost", + port: 5432, + username: "hummingbird", + password: "hummingbird", + database: "hummingbird", tls: .disable + ), + maxConnectionsPerEventLoop: 32 + ), + as: .psql + ) */ let persist = await HBFluentPersistDriver(fluent: fluent) // run migrations try await fluent.migrate()