-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7816b9
commit ef07391
Showing
27 changed files
with
804 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// Expense.swift | ||
// Data | ||
// | ||
// Created by Amisha Italiya on 20/03/24. | ||
// | ||
|
||
import FirebaseFirestore | ||
|
||
public struct Expense: Codable { | ||
|
||
@DocumentID public var id: String? // Automatically generated ID by Firestore | ||
|
||
let name: String | ||
let amount: Double | ||
let date: Date | ||
let paidBy: AppUser | ||
let splitTo: [Member] // Reference to users involved in the split | ||
let splitType: SplitType | ||
|
||
public init(name: String, amount: Double, date: Date, paidBy: AppUser, splitTo: [Member], splitType: SplitType) { | ||
self.name = name | ||
self.amount = amount | ||
self.date = date | ||
self.paidBy = paidBy | ||
self.splitTo = splitTo | ||
self.splitType = splitType | ||
} | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case name | ||
case amount | ||
case date | ||
case paidBy = "paied_by" | ||
case splitTo = "split_to" | ||
case splitType = "split_type" | ||
} | ||
} | ||
|
||
public enum SplitType: String, Codable { | ||
case equally | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// | ||
// ExpenseRepository.swift | ||
// Data | ||
// | ||
// Created by Amisha Italiya on 20/03/24. | ||
// | ||
|
||
import Foundation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.