Przeglądaj źródła

Adding Files

main
rpm-mcarman 2 lat temu
rodzic
commit
5c4b95aecb
5 zmienionych plików z 137 dodań i 0 usunięć
  1. +105
    -0
      Sources/App/Models/BaseTables/mdlSysCategory.swift
  2. +8
    -0
      Sources/App/Models/BaseTables/mdlSysOfMeasure.swift
  3. +8
    -0
      Sources/App/Models/BaseTables/mdlSysUOM.swift
  4. +8
    -0
      Sources/App/Models/mdlLocale.swift
  5. +8
    -0
      Sources/App/Models/mdlTblValue.swift

+ 105
- 0
Sources/App/Models/BaseTables/mdlSysCategory.swift Wyświetl plik

@@ -0,0 +1,105 @@
//
// mdlSysUnit.swift
//
//
// Created by Michiel Carman on 2/16/24.
//


import Fluent
import Vapor
import Foundation
import FluentKit

final class mdlSysCategory: Model, Content {
static let schema = "sysCategory"
@ID(custom: "id", generatedBy: .database) var id: Int?
@Field(key: "name") var name: String?
@Field(key: "description") var description: String?
@Timestamp(key: "createDate", on: .create) var createdate: Date?
@Field(key: "createUserId") var createuserid: Int?
@Timestamp(key: "updateDate", on: .update) var updatedate: Date?
@Field(key: "updateUserId") var updateuserid: Int?
init() { }
init(id: Int? = nil,
name: String? = nil,
description: String? = nil,
createuserid: Int? = nil,
updateuserid: Int? = nil
) {
self.id = id
self.name = name
self.description = description
self.createuserid = createuserid
self.updateuserid = updateuserid
}
}
extension mdlSysCategory{
struct Create: AsyncMigration {
func prepare(on database: Database) async throws {
try await database.schema("sysCategory")
.field("id", .int, .identifier(auto: true))
.field("name", .string)
.field("description", .string)
.field("createDate", .datetime)
.field("createUserId", .int)
.field("updateDate", .datetime)
.field("updateUserId", .int)
.create()
}
func revert(on database: Database) async throws {
try await database.schema("sysCategory").delete()
}
}
struct Seed: AsyncMigration{
func prepare(on database: FluentKit.Database) async throws {
let mdls: [mdlSysCategory] = [
.init(id: 1,
name: "LENGTH",
description: "Unit of distance.",
createuserid: -1,
updateuserid: -1),
.init(id: 1,
name: "WEIGHT",
description: "Unit of force.",
createuserid: -1,
updateuserid: -1),
.init(id: 1,
name: "CAPACITY",
description: "Unit of capacity.",
createuserid: -1,
updateuserid: -1),
.init(id: 1,
name: "VOLUME",
description: "Unit of volume.",
createuserid: -1,
updateuserid: -1),
.init(id: 1,
name: "AREA",
description: "Unit of area.",
createuserid: -1,
updateuserid: -1),
.init(id: 1,
name: "TEMPERATURE",
description: "Unit of temperature.",
createuserid: -1,
updateuserid: -1)
]
for mdl in mdls{
try await mdl.save(on: database)
}
}
func revert(on database: Database) async throws {
try await mdlSysCategory.query(on: database).delete()
}
}
}


+ 8
- 0
Sources/App/Models/BaseTables/mdlSysOfMeasure.swift Wyświetl plik

@@ -0,0 +1,8 @@
//
// File.swift
//
//
// Created by Michiel Carman on 5/6/24.
//

import Foundation

+ 8
- 0
Sources/App/Models/BaseTables/mdlSysUOM.swift Wyświetl plik

@@ -0,0 +1,8 @@
//
// File.swift
//
//
// Created by Michiel Carman on 5/6/24.
//

import Foundation

+ 8
- 0
Sources/App/Models/mdlLocale.swift Wyświetl plik

@@ -0,0 +1,8 @@
//
// File.swift
//
//
// Created by Michiel Carman on 5/14/24.
//

import Foundation

+ 8
- 0
Sources/App/Models/mdlTblValue.swift Wyświetl plik

@@ -0,0 +1,8 @@
//
// File.swift
//
//
// Created by Michiel Carman on 5/14/24.
//

import Foundation

Ładowanie…
Anuluj
Zapisz