added some initial routes, ways to show overall stats, matches
This commit is contained in:
43
Sources/App/Models/Match.swift
Normal file
43
Sources/App/Models/Match.swift
Normal file
@@ -0,0 +1,43 @@
|
||||
import Fluent
|
||||
import Vapor
|
||||
|
||||
final class Match: Model, Content {
|
||||
static let schema = "match"
|
||||
|
||||
@ID(key: .id)
|
||||
var id: UUID?
|
||||
|
||||
@Field(key: "map")
|
||||
var map: String?
|
||||
|
||||
@Field(key: "win")
|
||||
var win: Bool
|
||||
|
||||
@Field(key: "date")
|
||||
var date: Date
|
||||
|
||||
@Field(key: "roundsWon")
|
||||
var roundsWon: Int?
|
||||
|
||||
@Field(key: "roundsLost")
|
||||
var roundsLost: Int?
|
||||
|
||||
|
||||
init() { }
|
||||
|
||||
init(id: UUID? = nil, map:String?, win:Bool, date:Date, roundsWon:Int?, roundsLost:Int?) {
|
||||
self.id = id
|
||||
self.map = map
|
||||
self.win = win
|
||||
self.date = date
|
||||
self.roundsWon = roundsWon
|
||||
self.roundsLost = roundsLost
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension Match {
|
||||
struct Create: Content {
|
||||
}
|
||||
}
|
||||
|
||||
24
Sources/App/Models/Stats.swift
Normal file
24
Sources/App/Models/Stats.swift
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Stats.swift
|
||||
// App
|
||||
//
|
||||
// Created by Michael Simard on 5/29/20.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
import Fluent
|
||||
import Vapor
|
||||
|
||||
final class Stats: Content {
|
||||
var winLossRatio:String
|
||||
var totalWins:Int
|
||||
var totalLosses:Int
|
||||
|
||||
init( winLoss:String, totalWins:Int, totalLosses:Int) {
|
||||
self.winLossRatio = winLoss
|
||||
self.totalWins = totalWins
|
||||
self.totalLosses = totalLosses
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
import Fluent
|
||||
import Vapor
|
||||
|
||||
final class Todo: Model, Content {
|
||||
static let schema = "todos"
|
||||
|
||||
@ID(key: .id)
|
||||
var id: UUID?
|
||||
|
||||
@Field(key: "title")
|
||||
var title: String
|
||||
|
||||
init() { }
|
||||
|
||||
init(id: UUID? = nil, title: String) {
|
||||
self.id = id
|
||||
self.title = title
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user