Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New scheduled transaction #22

Merged
merged 14 commits into from
Sep 22, 2024
22 changes: 19 additions & 3 deletions MMEX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
929EF6632C9FF3ED0051A3E6 /* AssetRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 929EF6622C9FF3ED0051A3E6 /* AssetRepository.swift */; };
929EF6652C9FF3FB0051A3E6 /* StockRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 929EF6642C9FF3FB0051A3E6 /* StockRepository.swift */; };
929EF6672CA023EE0051A3E6 /* EnumCollateNoCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 929EF6662CA023EE0051A3E6 /* EnumCollateNoCase.swift */; };
929EF6692CA034770051A3E6 /* RepositoryProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 929EF6682CA034770051A3E6 /* RepositoryProtocol.swift */; };
929EF66B2CA03AF90051A3E6 /* ModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 929EF66A2CA03AF90051A3E6 /* ModelProtocol.swift */; };
929EF66D2CA0BA5E0051A3E6 /* Scheduled.swift in Sources */ = {isa = PBXBuildFile; fileRef = 929EF66C2CA0BA5E0051A3E6 /* Scheduled.swift */; };
929EF66F2CA0BC2D0051A3E6 /* ScheduledRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 929EF66E2CA0BC2D0051A3E6 /* ScheduledRepository.swift */; };
A3363EE32C9323A5004696C7 /* CategoryEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3363EE22C9323A5004696C7 /* CategoryEditView.swift */; };
A3363EE52C9323D2004696C7 /* CategoryDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3363EE42C9323D2004696C7 /* CategoryDetailView.swift */; };
A3363EE72C93249D004696C7 /* CategoryAddView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3363EE62C93249D004696C7 /* CategoryAddView.swift */; };
Expand Down Expand Up @@ -77,6 +81,10 @@
929EF6622C9FF3ED0051A3E6 /* AssetRepository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetRepository.swift; sourceTree = "<group>"; };
929EF6642C9FF3FB0051A3E6 /* StockRepository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StockRepository.swift; sourceTree = "<group>"; };
929EF6662CA023EE0051A3E6 /* EnumCollateNoCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EnumCollateNoCase.swift; sourceTree = "<group>"; };
929EF6682CA034770051A3E6 /* RepositoryProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepositoryProtocol.swift; sourceTree = "<group>"; };
929EF66A2CA03AF90051A3E6 /* ModelProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModelProtocol.swift; sourceTree = "<group>"; };
929EF66C2CA0BA5E0051A3E6 /* Scheduled.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Scheduled.swift; sourceTree = "<group>"; };
929EF66E2CA0BC2D0051A3E6 /* ScheduledRepository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScheduledRepository.swift; sourceTree = "<group>"; };
A3363EE22C9323A5004696C7 /* CategoryEditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryEditView.swift; sourceTree = "<group>"; };
A3363EE42C9323D2004696C7 /* CategoryDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryDetailView.swift; sourceTree = "<group>"; };
A3363EE62C93249D004696C7 /* CategoryAddView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryAddView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -154,6 +162,8 @@
children = (
A3462F652C94854800F79145 /* ExportableEntity.swift */,
929EF6662CA023EE0051A3E6 /* EnumCollateNoCase.swift */,
929EF66A2CA03AF90051A3E6 /* ModelProtocol.swift */,
929EF6682CA034770051A3E6 /* RepositoryProtocol.swift */,
);
path = Protocols;
sourceTree = "<group>";
Expand Down Expand Up @@ -249,6 +259,8 @@
A3C142A12C90267F00D3CEC0 /* CategoryRepository.swift */,
A3C142932C8FE13E00D3CEC0 /* PayeeRepository.swift */,
A3C142952C8FE15E00D3CEC0 /* TransactionRepository.swift */,
929EF66E2CA0BC2D0051A3E6 /* ScheduledRepository.swift */,
A37E7D992C9BC28900B4ECFC /* Row.swift */,
);
path = Repositories;
sourceTree = "<group>";
Expand Down Expand Up @@ -306,7 +318,7 @@
A3C1429F2C9025D600D3CEC0 /* Category.swift */,
A3C1424D2C8B335900D3CEC0 /* Payee.swift */,
A3C142662C8F2AF500D3CEC0 /* Transaction.swift */,
A37E7D992C9BC28900B4ECFC /* Row.swift */,
929EF66C2CA0BA5E0051A3E6 /* Scheduled.swift */,
);
path = Models;
sourceTree = "<group>";
Expand All @@ -316,10 +328,10 @@
children = (
A39B1B3E2C9A6714003E5562 /* Settings */,
A39B1B3D2C9A66F7003E5562 /* Currencies */,
A39B1B392C9A668F003E5562 /* Accounts */,
A39B1B3C2C9A66E6003E5562 /* Categories */,
A39B1B3B2C9A66CB003E5562 /* Transactions */,
A39B1B3A2C9A66B8003E5562 /* Payees */,
A39B1B392C9A668F003E5562 /* Accounts */,
A39B1B3B2C9A66CB003E5562 /* Transactions */,
A3C142A72C906E0A00D3CEC0 /* CustomNumberPadView.swift */,
A3462F632C9426F500F79145 /* InsightsViewModel.swift */,
A3C142AD2C9134DD00D3CEC0 /* InsightsView.swift */,
Expand Down Expand Up @@ -435,6 +447,7 @@
A3C1429A2C8FF77D00D3CEC0 /* TransactionDetailView.swift in Sources */,
A3C142942C8FE13E00D3CEC0 /* PayeeRepository.swift in Sources */,
A3C1429E2C8FFCF100D3CEC0 /* TransactionAddView.swift in Sources */,
929EF66B2CA03AF90051A3E6 /* ModelProtocol.swift in Sources */,
A3C142922C8FE11700D3CEC0 /* AccountRepository.swift in Sources */,
A3C1422B2C89751500D3CEC0 /* MMEXApp.swift in Sources */,
A39B1B362C99A0C2003E5562 /* CurrencyEditView.swift in Sources */,
Expand All @@ -453,15 +466,18 @@
A3C142982C8FE62200D3CEC0 /* TransactionListView.swift in Sources */,
A3C142542C8B381400D3CEC0 /* PayeeEditView.swift in Sources */,
A37E7D8A2C9AC30700B4ECFC /* HelpFAQView.swift in Sources */,
929EF66D2CA0BA5E0051A3E6 /* Scheduled.swift in Sources */,
A3363EE32C9323A5004696C7 /* CategoryEditView.swift in Sources */,
A3C142652C8ED8EA00D3CEC0 /* AccountEditView.swift in Sources */,
A3C142632C8ED8C000D3CEC0 /* AccountAddView.swift in Sources */,
929EF6692CA034770051A3E6 /* RepositoryProtocol.swift in Sources */,
A3C142A22C90267F00D3CEC0 /* CategoryRepository.swift in Sources */,
A37E7D862C9AC2D000B4ECFC /* AboutView.swift in Sources */,
A3363EE92C9326A1004696C7 /* CategoryListView.swift in Sources */,
A3C142A02C9025D600D3CEC0 /* Category.swift in Sources */,
A3C142A42C9033E300D3CEC0 /* SettingsView.swift in Sources */,
A3363EE52C9323D2004696C7 /* CategoryDetailView.swift in Sources */,
929EF66F2CA0BC2D0051A3E6 /* ScheduledRepository.swift in Sources */,
A37E7D842C9AC14800B4ECFC /* ManagementView.swift in Sources */,
A37E7D902C9AC4F300B4ECFC /* TermsOfServiceView.swift in Sources */,
);
Expand Down
85 changes: 50 additions & 35 deletions MMEX/Models/Account.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation
import SQLite

enum AccountStatus: String, EnumCollateNoCase {
case open = "Open"
case open = "Open"
case closed = "Closed"
}

Expand All @@ -25,39 +25,53 @@ enum AccountType: String, EnumCollateNoCase {
}

struct Account: ExportableEntity {
var id: Int64
var name: String
var type: AccountType
var num: String?
var status: AccountStatus
var notes: String?
var heldAt: String?
var website: String?
var contactInfo: String?
var accessInfo: String?
var initialDate: String?
var initialBal: Double?
var favoriteAcct: String
var currencyId: Int64
var statementLocked: Bool?
var statementDate: String?
var minimumBalance: Double?
var creditLimit: Double?
var interestRate: Double?
var paymentDueDate: String?
var minimumPayment: Double?
var id : Int64
var name : String
var type : AccountType
var num : String
var status : AccountStatus
var notes : String
var heldAt : String
var website : String
var contactInfo : String
var accessInfo : String
var initialDate : String
var initialBal : Double
var favoriteAcct : String
var currencyId : Int64
var statementLocked : Bool
var statementDate : String
var minimumBalance : Double
var creditLimit : Double
var interestRate : Double
var paymentDueDate : String
var minimumPayment : Double

var currency: Currency?

init(
id: Int64, name: String, type: AccountType,
num: String? = nil, status: AccountStatus, notes: String? = nil,
heldAt: String? = nil, website: String? = nil, contactInfo: String? = nil,
accessInfo: String? = nil, initialDate: String? = nil, initialBal: Double? = nil,
favoriteAcct: String, currencyId: Int64, statementLocked: Bool? = nil,
statementDate: String? = nil, minimumBalance: Double? = nil, creditLimit: Double? = nil,
interestRate: Double? = nil, paymentDueDate: String? = nil, minimumPayment: Double? = nil,
currency: Currency? = nil
id : Int64 = 0,
name : String = "",
type : AccountType = AccountType.checking,
num : String = "",
status : AccountStatus = AccountStatus.closed,
notes : String = "",
heldAt : String = "",
website : String = "",
contactInfo : String = "",
accessInfo : String = "",
initialDate : String = "",
initialBal : Double = 0.0,
favoriteAcct : String = "",
currencyId : Int64 = 0,
statementLocked : Bool = false,
statementDate : String = "",
minimumBalance : Double = 0.0,
creditLimit : Double = 0.0,
interestRate : Double = 0.0,
paymentDueDate : String = "",
minimumPayment : Double = 0.0,
currency : Currency? = nil
) {
self.id = id
self.name = name
Expand All @@ -84,11 +98,12 @@ struct Account: ExportableEntity {
}
}

extension Account {
static var empty: Account { Account(
id: 0, name: "", type: AccountType.cash, status: AccountStatus.open, notes: "",
initialBal: 0.0, favoriteAcct: "TRUE", currencyId: 0
) }
extension Account: ModelProtocol {
static let modelName = "Account"

func shortDesc() -> String {
"\(self.name)"
}
}

extension Account {
Expand Down
40 changes: 24 additions & 16 deletions MMEX/Models/Asset.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,29 @@ enum AssetChangeMode: String, EnumCollateNoCase {

struct Asset: ExportableEntity {
var id : Int64
var type : AssetType?
var status : AssetStatus?
var type : AssetType
var status : AssetStatus
var name : String
var startDate : String
var currencyId : Int64?
var value : Double?
var change : AssetChange?
var changeMode : AssetChangeMode?
var changeRate : Double?
var notes : String?
var currencyId : Int64
var value : Double
var change : AssetChange
var changeMode : AssetChangeMode
var changeRate : Double
var notes : String

init(
id : Int64 = 0,
type : AssetType? = nil,
status : AssetStatus? = nil,
type : AssetType = AssetType.property,
status : AssetStatus = AssetStatus.open,
name : String = "",
startDate : String = "",
currencyId : Int64? = nil,
value : Double? = nil,
change : AssetChange? = nil,
changeMode : AssetChangeMode? = nil,
changeRate : Double? = nil,
notes : String? = nil
currencyId : Int64 = 0,
value : Double = 0.0,
change : AssetChange = AssetChange.none,
changeMode : AssetChangeMode = AssetChangeMode.percentage,
changeRate : Double = 0.0,
notes : String = ""
) {
self.id = id
self.type = type
Expand All @@ -74,6 +74,14 @@ struct Asset: ExportableEntity {
}
}

extension Asset: ModelProtocol {
static let modelName = "Asset"

func shortDesc() -> String {
"\(self.name), \(self.id)"
}
}

extension Asset {
static let sampleData: [Asset] = [
Asset(
Expand Down
37 changes: 26 additions & 11 deletions MMEX/Models/Category.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,35 @@ import Foundation
import SQLite

struct Category: ExportableEntity {
var id: Int64
var name: String
var active: Bool?
var parentId: Int64?
var id : Int64
var name : String
var active : Bool
var parentId : Int64

init(
id : Int64 = 0,
name : String = "",
active : Bool = false,
parentId : Int64 = 0
) {
self.id = id
self.name = name
self.active = active
self.parentId = parentId
}
}

extension Category {
// empty category
static var empty : Category { Category(
id: 1, name: "cateogry name", active: true, parentId: nil
) }

var isRoot: Bool {
return parentId == nil || parentId! <= 0
return parentId <= 0
}
}

extension Category: ModelProtocol {
static let modelName = "Category"

func shortDesc() -> String {
"\(self.name), \(self.id)"
}
}

Expand Down Expand Up @@ -88,7 +103,7 @@ extension Category {

extension Category {
static let sampleData: [Category] = [
Category(id: 1, name: "root cateogry", active: true, parentId: nil),
Category(id: 1, name: "root cateogry", active: true, parentId: -1),
Category(id: 2, name: "non-root category", active: true, parentId: 1),
]
}
Loading