Skip to content

Commit

Permalink
switch JobData back to Data
Browse files Browse the repository at this point in the history
  • Loading branch information
m-barthelemy committed Apr 6, 2020
1 parent fdca2df commit 3b1700e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Sources/QueuesFluentDriver/FluentQueue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ extension FluentQueue: Queue {
.first()
.unwrap(or: QueuesFluentError.missingJob(id))
.flatMapThrowing { job in
let jobData = job.data//try JSONDecoder().decode(JobData.self, from: job.data)
return jobData!
let jobData = try! JSONDecoder().decode(JobData.self, from: job.data)
return jobData
}
}

Expand Down
6 changes: 3 additions & 3 deletions Sources/QueuesFluentDriver/JobModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class JobModel: Model {

/// The Job data
@Field(key: "data")
var data: JobData?
//var data: Data
//var data: JobData?
var data: Data

/// The current state of the Job
@Field(key: "state")
Expand All @@ -50,7 +50,7 @@ class JobModel: Model {
init(id: UUID, key: String, data: JobData? = nil) {
self.id = id
self.key = key
//self.data = data
self.data = try! JSONEncoder().encode(data)
self.state = .initial
}
}
2 changes: 1 addition & 1 deletion Sources/QueuesFluentDriver/JobModelMigrate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public struct JobModelMigrate: Migration {
return database.schema(JobModel.schema)
.id()
.field(model.$key.key, .string, .required)
.field(model.$data.key, .json) //, .required)
.field(model.$data.key, .data, .required)
.field(model.$state.key, .string, .required)
.field(model.$createdAt.path.first!, .datetime)
.field(model.$updatedAt.path.first!, .datetime)
Expand Down

0 comments on commit 3b1700e

Please sign in to comment.