Skip to content

Commit

Permalink
Merge pull request #52 from moneymanagerex/new_models-8
Browse files Browse the repository at this point in the history
Add Field, FieldContent
  • Loading branch information
georgeef authored Sep 26, 2024
2 parents f18c81d + e67e302 commit b41be68
Show file tree
Hide file tree
Showing 27 changed files with 399 additions and 163 deletions.
16 changes: 16 additions & 0 deletions MMEX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
920824222CA4E67200388AB2 /* TagLinkRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 920824212CA4E67200388AB2 /* TagLinkRepository.swift */; };
920824242CA5078900388AB2 /* TransactionShareData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 920824232CA5078900388AB2 /* TransactionShareData.swift */; };
920824262CA5082D00388AB2 /* TransactionShareRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 920824252CA5082D00388AB2 /* TransactionShareRepository.swift */; };
920824282CA60E8400388AB2 /* FieldData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 920824272CA60E8400388AB2 /* FieldData.swift */; };
9208242A2CA60FD900388AB2 /* FieldContentData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 920824292CA60FD900388AB2 /* FieldContentData.swift */; };
9208242C2CA615B400388AB2 /* FieldRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9208242B2CA615B400388AB2 /* FieldRepository.swift */; };
9208242E2CA617FB00388AB2 /* FieldContentRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9208242D2CA617FB00388AB2 /* FieldContentRepository.swift */; };
929EF65F2C9FF2DE0051A3E6 /* AssetData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 929EF65E2C9FF2DE0051A3E6 /* AssetData.swift */; };
929EF6612C9FF2FD0051A3E6 /* StockData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 929EF6602C9FF2FD0051A3E6 /* StockData.swift */; };
929EF6632C9FF3ED0051A3E6 /* AssetRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 929EF6622C9FF3ED0051A3E6 /* AssetRepository.swift */; };
Expand Down Expand Up @@ -130,6 +134,10 @@
920824212CA4E67200388AB2 /* TagLinkRepository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TagLinkRepository.swift; sourceTree = "<group>"; };
920824232CA5078900388AB2 /* TransactionShareData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionShareData.swift; sourceTree = "<group>"; };
920824252CA5082D00388AB2 /* TransactionShareRepository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionShareRepository.swift; sourceTree = "<group>"; };
920824272CA60E8400388AB2 /* FieldData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FieldData.swift; sourceTree = "<group>"; };
920824292CA60FD900388AB2 /* FieldContentData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FieldContentData.swift; sourceTree = "<group>"; };
9208242B2CA615B400388AB2 /* FieldRepository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FieldRepository.swift; sourceTree = "<group>"; };
9208242D2CA617FB00388AB2 /* FieldContentRepository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FieldContentRepository.swift; sourceTree = "<group>"; };
929EF65E2C9FF2DE0051A3E6 /* AssetData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetData.swift; sourceTree = "<group>"; };
929EF6602C9FF2FD0051A3E6 /* StockData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StockData.swift; sourceTree = "<group>"; };
929EF6622C9FF3ED0051A3E6 /* AssetRepository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetRepository.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -352,6 +360,8 @@
920824072CA4B05700388AB2 /* ScheduledSplitRepository.swift */,
920823FF2CA4A4AA00388AB2 /* TagRepository.swift */,
920824212CA4E67200388AB2 /* TagLinkRepository.swift */,
9208242B2CA615B400388AB2 /* FieldRepository.swift */,
9208242D2CA617FB00388AB2 /* FieldContentRepository.swift */,
920824192CA4D35700388AB2 /* AttachmentRepository.swift */,
9208240F2CA4C5CD00388AB2 /* BudgetYearRepository.swift */,
920824112CA4C6A400388AB2 /* BudgetTableRepository.swift */,
Expand Down Expand Up @@ -426,6 +436,8 @@
920824032CA4ADC100388AB2 /* ScheduledSplitData.swift */,
920823FD2CA4A3F700388AB2 /* TagData.swift */,
9208241F2CA4E5C200388AB2 /* TagLinkData.swift */,
920824272CA60E8400388AB2 /* FieldData.swift */,
920824292CA60FD900388AB2 /* FieldContentData.swift */,
920824172CA4CF4300388AB2 /* AttachmentData.swift */,
920824092CA4C2AD00388AB2 /* BudgetYearData.swift */,
9208240B2CA4C31B00388AB2 /* BudgetTableData.swift */,
Expand Down Expand Up @@ -535,6 +547,7 @@
920823FA2CA49A4B00388AB2 /* StockHistoryData.swift in Sources */,
A37E7D8E2C9AC4C900B4ECFC /* PrivacyPolicyView.swift in Sources */,
A3C142612C8E9DBF00D3CEC0 /* PayeeAddView.swift in Sources */,
9208242C2CA615B400388AB2 /* FieldRepository.swift in Sources */,
A39B1B382C99A0D8003E5562 /* CurrencyListView.swift in Sources */,
920824082CA4B05700388AB2 /* ScheduledSplitRepository.swift in Sources */,
A30061762CA3B58700011B1A /* AssetDetailView.swift in Sources */,
Expand Down Expand Up @@ -573,6 +586,7 @@
920823FC2CA4A15C00388AB2 /* StockHistoryRepository.swift in Sources */,
A3C142942C8FE13E00D3CEC0 /* PayeeRepository.swift in Sources */,
A3C1429E2C8FFCF100D3CEC0 /* TransactionAddView.swift in Sources */,
920824282CA60E8400388AB2 /* FieldData.swift in Sources */,
929EF66B2CA03AF90051A3E6 /* Data.swift in Sources */,
A3C142922C8FE11700D3CEC0 /* AccountRepository.swift in Sources */,
A3C1422B2C89751500D3CEC0 /* MMEXApp.swift in Sources */,
Expand All @@ -587,10 +601,12 @@
9208240A2CA4C2AD00388AB2 /* BudgetYearData.swift in Sources */,
A3363EEB2C93BF62004696C7 /* CurrencyRepository.swift in Sources */,
A37E7D942C9B217500B4ECFC /* InfotableData.swift in Sources */,
9208242E2CA617FB00388AB2 /* FieldContentRepository.swift in Sources */,
9208241E2CA4E1C500388AB2 /* TransactionLinkRepository.swift in Sources */,
9208241A2CA4D35700388AB2 /* AttachmentRepository.swift in Sources */,
A37E7D882C9AC2E600B4ECFC /* VersionInfoView.swift in Sources */,
920823F62CA498A200388AB2 /* CurrencyHistoryData.swift in Sources */,
9208242A2CA60FD900388AB2 /* FieldContentData.swift in Sources */,
A3462F662C94854800F79145 /* ExportableEntity.swift in Sources */,
A3462F6A2C948CDB00F79145 /* ExportableEntityDocument.swift in Sources */,
920824122CA4C6A400388AB2 /* BudgetTableRepository.swift in Sources */,
Expand Down
31 changes: 31 additions & 0 deletions MMEX/Models/FieldContentData.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// FieldContentData.swift
// MMEX
//
// Created 2024-09-26 by George Ef ([email protected])
//

import Foundation
import SQLite

struct FieldContentData: ExportableEntity {
var id : Int64 = 0
var fieldId : Int64 = 0
var refType : RefType = RefType.transaction
var refId : Int64 = 0
var content : String = ""
static let refTypes: Set<RefType> = [ .transaction, .scheduled ]
}

extension FieldContentData: DataProtocol {
static let dataName = "FieldContent"

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

extension FieldContentData {
static let sampleData: [FieldContentData] = [
]
}
44 changes: 44 additions & 0 deletions MMEX/Models/FieldData.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// Field.swift
// MMEX
//
// Created 2024-09-26 by George Ef ([email protected])
//

import Foundation
import SQLite

enum FieldType: String, EnumCollateNoCase {
case string = "String"
case integer = "Integer"
case decimal = "Decimal"
case boolean = "Boolean"
case date = "Date"
case time = "Time"
case singleChoice = "SingleChoice"
case multiChoice = "MultiChoice"
case unknown = ""
static let defaultValue = Self.unknown
}

struct FieldData: ExportableEntity {
var id : Int64 = 0
var refType : RefType = RefType.defaultValue
var description : String = ""
var type : FieldType = FieldType.defaultValue
var properties : String = ""
static let refTypes: Set<RefType> = [ .transaction, .scheduled ]
}

extension FieldData: DataProtocol {
static let dataName = "Field"

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

extension FieldData {
static let sampleData: [FieldData] = [
]
}
2 changes: 1 addition & 1 deletion MMEX/Models/TagLinkData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct TagLinkData: ExportableEntity {
}

extension TagLinkData: DataProtocol {
static let dataName = "TagLinkData"
static let dataName = "TagLink"

func shortDesc() -> String {
"\(self.id)"
Expand Down
42 changes: 21 additions & 21 deletions MMEX/Repositories/AccountRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,28 +125,28 @@ class AccountRepository: RepositoryProtocol {
)
}

static func itemSetters(_ account: AccountData) -> [SQLite.Setter] {
static func itemSetters(_ data: AccountData) -> [SQLite.Setter] {
return [
col_name <- account.name,
col_type <- account.type.id,
col_num <- account.num,
col_status <- account.status.id,
col_notes <- account.notes,
col_heldAt <- account.heldAt,
col_website <- account.website,
col_contactInfo <- account.contactInfo,
col_accessInfo <- account.accessInfo,
col_initialDate <- account.initialDate,
col_initialBal <- account.initialBal,
col_favoriteAcct <- account.favoriteAcct,
col_currencyId <- account.currencyId,
col_statementLocked <- account.statementLocked ? 1 : 0,
col_statementDate <- account.statementDate,
col_minimumBalance <- account.minimumBalance,
col_creditLimit <- account.creditLimit,
col_interestRate <- account.interestRate,
col_paymentDueDate <- account.paymentDueDate,
col_minimumPayment <- account.minimumPayment
col_name <- data.name,
col_type <- data.type.id,
col_num <- data.num,
col_status <- data.status.id,
col_notes <- data.notes,
col_heldAt <- data.heldAt,
col_website <- data.website,
col_contactInfo <- data.contactInfo,
col_accessInfo <- data.accessInfo,
col_initialDate <- data.initialDate,
col_initialBal <- data.initialBal,
col_favoriteAcct <- data.favoriteAcct,
col_currencyId <- data.currencyId,
col_statementLocked <- data.statementLocked ? 1 : 0,
col_statementDate <- data.statementDate,
col_minimumBalance <- data.minimumBalance,
col_creditLimit <- data.creditLimit,
col_interestRate <- data.interestRate,
col_paymentDueDate <- data.paymentDueDate,
col_minimumPayment <- data.minimumPayment
]
}
}
Expand Down
22 changes: 11 additions & 11 deletions MMEX/Repositories/AssetRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,18 @@ class AssetRepository: RepositoryProtocol {
)
}

static func itemSetters(_ asset: AssetData) -> [SQLite.Setter] {
static func itemSetters(_ data: AssetData) -> [SQLite.Setter] {
return [
col_type <- asset.type.name,
col_status <- asset.status.name,
col_name <- asset.name,
col_startDate <- asset.startDate,
col_currencyId <- asset.currencyId,
col_value <- asset.value,
col_change <- asset.change.name,
col_changeMode <- asset.changeMode.name,
col_changeRate <- asset.changeRate,
col_notes <- asset.notes
col_type <- data.type.name,
col_status <- data.status.name,
col_name <- data.name,
col_startDate <- data.startDate,
col_currencyId <- data.currencyId,
col_value <- data.value,
col_change <- data.change.name,
col_changeMode <- data.changeMode.name,
col_changeRate <- data.changeRate,
col_notes <- data.notes
]
}
}
Expand Down
10 changes: 5 additions & 5 deletions MMEX/Repositories/AttachmentRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ class AttachmentRepository: RepositoryProtocol {
)
}

static func itemSetters(_ attachment: AttachmentData) -> [SQLite.Setter] {
static func itemSetters(_ data: AttachmentData) -> [SQLite.Setter] {
return [
col_refType <- attachment.refType.rawValue,
col_refId <- attachment.refId,
col_description <- attachment.description,
col_filename <- attachment.filename
col_refType <- data.refType.rawValue,
col_refId <- data.refId,
col_description <- data.description,
col_filename <- data.filename
]
}
}
Expand Down
14 changes: 7 additions & 7 deletions MMEX/Repositories/BudgetTableRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ class BudgetTableRepository: RepositoryProtocol {
)
}

static func itemSetters(_ budget: BudgetTableData) -> [SQLite.Setter] {
static func itemSetters(_ data: BudgetTableData) -> [SQLite.Setter] {
return [
col_yearId <- budget.yearId,
col_categId <- budget.categId,
col_period <- budget.period.rawValue,
col_amount <- budget.amount,
col_notes <- budget.notes,
col_active <- budget.active ? 1 : 0
col_yearId <- data.yearId,
col_categId <- data.categId,
col_period <- data.period.rawValue,
col_amount <- data.amount,
col_notes <- data.notes,
col_active <- data.active ? 1 : 0
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions MMEX/Repositories/BudgetYearRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class BudgetYearRepository: RepositoryProtocol {
)
}

static func itemSetters(_ year: BudgetYearData) -> [SQLite.Setter] {
static func itemSetters(_ data: BudgetYearData) -> [SQLite.Setter] {
return [
col_name <- year.name
col_name <- data.name
]
}
}
Expand Down
8 changes: 4 additions & 4 deletions MMEX/Repositories/CategoryRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ class CategoryRepository: RepositoryProtocol {
)
}

static func itemSetters(_ category: CategoryData) -> [SQLite.Setter] {
static func itemSetters(_ data: CategoryData) -> [SQLite.Setter] {
return [
col_name <- category.name,
col_active <- category.active ? 1 : 0,
col_parentId <- category.parentId
col_name <- data.name,
col_active <- data.active ? 1 : 0,
col_parentId <- data.parentId
]
}
}
Expand Down
10 changes: 5 additions & 5 deletions MMEX/Repositories/CurrencyHistoryRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ class CurrencyHistoryRepository: RepositoryProtocol {
)
}

static func itemSetters(_ history: CurrencyHistoryData) -> [SQLite.Setter] {
static func itemSetters(_ data: CurrencyHistoryData) -> [SQLite.Setter] {
return [
col_currencyId <- history.currencyId,
col_currDate <- history.date,
col_currValue <- history.baseConvRate,
col_currUpdType <- history.updateType?.rawValue
col_currencyId <- data.currencyId,
col_currDate <- data.date,
col_currValue <- data.baseConvRate,
col_currUpdType <- data.updateType?.rawValue
]
}
}
Expand Down
24 changes: 12 additions & 12 deletions MMEX/Repositories/CurrencyRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,19 @@ class CurrencyRepository: RepositoryProtocol {
)
}

static func itemSetters(_ currency: CurrencyData) -> [SQLite.Setter] {
static func itemSetters(_ data: CurrencyData) -> [SQLite.Setter] {
return [
col_name <- currency.name,
col_prefixSymbol <- currency.prefixSymbol,
col_suffixSymbol <- currency.suffixSymbol,
col_decimalPoint <- currency.decimalPoint,
col_groupSeparator <- currency.groupSeparator,
col_unitName <- currency.unitName,
col_centName <- currency.centName,
col_scale <- currency.scale,
col_baseConversionRate <- currency.baseConvRate,
col_symbol <- currency.symbol,
col_type <- currency.type
col_name <- data.name,
col_prefixSymbol <- data.prefixSymbol,
col_suffixSymbol <- data.suffixSymbol,
col_decimalPoint <- data.decimalPoint,
col_groupSeparator <- data.groupSeparator,
col_unitName <- data.unitName,
col_centName <- data.centName,
col_scale <- data.scale,
col_baseConversionRate <- data.baseConvRate,
col_symbol <- data.symbol,
col_type <- data.type
]
}
}
Expand Down
Loading

0 comments on commit b41be68

Please sign in to comment.