feat: Adds script to generate database seeded values and removes old mock storage.
This commit is contained in:
@@ -60,6 +60,46 @@ public extension Employee {
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
//
|
||||
// public extension Employee {
|
||||
//
|
||||
// static func generateMocks(count: Int = 10) -> [Self] {
|
||||
// @Dependency(\.date.now) var now
|
||||
// @Dependency(\.uuid) var uuid
|
||||
//
|
||||
// var output = [Self]()
|
||||
//
|
||||
// for _ in 0 ... count {
|
||||
// output.append(.init(
|
||||
// id: uuid(),
|
||||
// active: Bool.random(),
|
||||
// createdAt: now,
|
||||
// firstName: RandomNames.firstNames.randomElement()!,
|
||||
// lastName: RandomNames.lastNames.randomElement()!,
|
||||
// updatedAt: now
|
||||
// ))
|
||||
// }
|
||||
//
|
||||
// return output
|
||||
// }
|
||||
// }
|
||||
|
||||
public extension Employee.Create {
|
||||
|
||||
static func generateMocks(count: Int = 5) -> [Self] {
|
||||
(0 ... count).reduce(into: [Self]()) { array, _ in
|
||||
array.append(.init(
|
||||
firstName: RandomNames.firstNames.randomElement()! + String(RandomNames.characterString.randomElement()!),
|
||||
lastName: RandomNames.lastNames.randomElement()! + String(RandomNames.characterString.randomElement()!),
|
||||
active: Bool.random()
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// public extension Employee {
|
||||
// static var mocks: [Self] {
|
||||
// [
|
||||
|
||||
Reference in New Issue
Block a user