Skip to content

Commit

Permalink
Upgrade to SwiftSQL 0.2.x
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Collins <[email protected]>
  • Loading branch information
rymcol committed Mar 10, 2017
1 parent f672c42 commit cd928ca
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Perfect-ToDo-API/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ let package = Package(
.Package(url: "https://github.com/PerfectlySoft/Perfect-HTTPServer.git", majorVersion: 2),
.Package(url: "https://github.com/SwiftORM/MySQL-StORM.git", majorVersion: 1, minor: 0),
.Package(url: "https://github.com/PerfectlySoft/Perfect-Turnstile-MySQL.git", majorVersion: 1, minor: 0),
.Package(url: "https://github.com/rymcol/SwiftSQL.git", majorVersion: 0, minor: 1),
.Package(url: "https://github.com/rymcol/SwiftSQL.git", majorVersion: 0, minor: 2),
]
)
4 changes: 2 additions & 2 deletions Perfect-ToDo-API/Sources/ToDo-API/ToDoItems.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct Items {

do {
let newItem = try ToDoManager().create(item: name, dueDate: dueDate, forToken: token)
let json: [String: Any] = ["item": "\(newItem.item)", "dueDate": newItem.dueDate == nil ? "NULL" : "\(getSQLDateTime(newItem.dueDate!))", "id": newItem.id]
let json: [String: Any] = ["item": "\(newItem.item)", "dueDate": newItem.dueDate == nil ? "NULL" : "\(newItem.dueDate!.sqlDateTime())", "id": newItem.id]
response = try json.jsonEncodedString()
} catch {

Expand Down Expand Up @@ -62,7 +62,7 @@ struct Items {
var json: [String: Any] = [String: Any]()
var itemList = [[String: Any]]()
for item in items {
itemList.append(["item": "\(item.item)", "dueDate": item.dueDate == nil ? "NULL" : "\(getSQLDateTime(item.dueDate!))", "id": item.id, "completed": item.isCompleted])
itemList.append(["item": "\(item.item)", "dueDate": item.dueDate == nil ? "NULL" : "\(item.dueDate!.sqlDateTime())", "id": item.id, "completed": item.isCompleted])
}
json["todos"] = itemList
response = try json.jsonEncodedString()
Expand Down
2 changes: 1 addition & 1 deletion Perfect-ToDo-API/Sources/ToDoModel/ToDoItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class ToDoItem: MySQLStORM {
}

func setDueDate(_ date: Date) {
due = getSQLDateTime(date)
due = date.sqlDateTime()
}

func removeDueDate() {
Expand Down
2 changes: 1 addition & 1 deletion Perfect-ToDo-API/Sources/ToDoModel/ToDoManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public struct ToDoManager {
}

let objCompletion = obj.isCompleted ? 1: 0
let objDate = obj.dueDate == nil ? "NULL": getSQLDateTime(obj.dueDate!)
let objDate = obj.dueDate == nil ? "NULL": obj.dueDate!.sqlDateTime()

do {
try obj.update(cols: ["completed", "item", "due"], params: [objCompletion, "\(obj.item)", objDate], idName: "id", idValue: obj.id)
Expand Down

0 comments on commit cd928ca

Please sign in to comment.