Releases: simonedelmann/crud-kit
1.1.0
Async support for public instance
There is a new method func `public`(eventLoop: EventLoop, db: Database) -> EventLoopFuture<Public>
in the Publicable
protocol, which (by default) converts your public instance to an EventLoopFuture<Public>
. You can override that behavior to run asynchronous code and access the database (querying relationships, ...) when calculating your public instance. (See updated README.md and tests for an example.)
Breaking changes
The internal method EventLoopFuture.public()
has a new db
parameter: func `public`(db: Database)
.
If you used crud-kit in the documented way, this should not affect you.
1.0.5
- Fix deprecation warnings in Xcode
1.0.4
- Update dependencies to use vapor's 4.0.0 release instead of beta
- Fix deprecation warning for
validate(content:)
1.0.3
- Fix non-public methods on CRUD protocols
- Improve internal routes setup
1.0.2
Internal Changes only
CRUDController
/ CRUDChildrenController
now base on a protocol CRUDControllerProtocol
/ CRUDChildrenControllerProtocol
, which provides the whole logic. This adds an (currently undocumented) option to use these protocol for own customized controller implementations.
1.0.1
1.0.0
Add relationship support
0.0.3
!!! Breaking changes !!!
-
Add a new protocol
Crudable
, which summarizesPublicable & Createable & Replaceable
. Models now have to conform toCrudable
by default. -
Improve
Publicable
,Createable
andReplaceable
to not require custom code but provide a default implementation.
// Before
extension Todo: Publicable {
var `public`: Todo {
return self
}
}
// After
extension Todo: Publicable { }
-
Publicable
now requires a computed propertyvar public
instead offunc public()
-
Replaceable
now needsreplace(with data)
to return an instance ofSelf
:func replace(with data: Replace) -> Self
New features
- The extension
.crud()
toRoutesBuilder
does now support custom routes.
// routes.swift
app.crud("todos", model: Todo.self) { routes in
// GET /todos/:todos/hello
routes.get("hello") { _ in "Hello World" }
}
Changes under the hood
CrudController
now stores anidComponentKey
which defaults to the models endpoint. This is preparing for relationship support.
Improve routing
!!! Breaking changes !!!
Changes the RoutesBuilder
extension to natively support the required path:
// Old syntax
routes.group("todos").crud(model: Todo.self)
// New syntax
routes.crud("todos", model: Todo.self)
Initial release
Initial release of crud-kit
. Check Readme for more details.