Adding SwiftData models
This commit is contained in:
parent
0c8fa61601
commit
4037dd9617
@ -11,6 +11,12 @@
|
||||
7A06E0AE2C7065C7005731AC /* SettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A06E0AD2C7065C7005731AC /* SettingsViewModel.swift */; };
|
||||
7A06E0B32C707E13005731AC /* SettingsServiceProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A06E0B22C707E13005731AC /* SettingsServiceProtocol.swift */; };
|
||||
7A06E0B52C707E2B005731AC /* SettingsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A06E0B42C707E2B005731AC /* SettingsService.swift */; };
|
||||
7A0818722DF83CF0000219FE /* SDVehicle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0818712DF83CF0000219FE /* SDVehicle.swift */; };
|
||||
7A0818742DF83D98000219FE /* SDVehicleBrand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0818732DF83D98000219FE /* SDVehicleBrand.swift */; };
|
||||
7A0818762DF83DB4000219FE /* SDVehicleName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0818752DF83DB4000219FE /* SDVehicleName.swift */; };
|
||||
7A0818782DF84AE4000219FE /* SDVehicleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0818772DF84AE4000219FE /* SDVehicleModel.swift */; };
|
||||
7A08187A2DF84B77000219FE /* SDVehicleEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0818792DF84B77000219FE /* SDVehicleEngine.swift */; };
|
||||
7A08187E2DF84CE0000219FE /* SDVehiclePhoto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A08187D2DF84CE0000219FE /* SDVehiclePhoto.swift */; };
|
||||
7A10226C2C551EC500B84627 /* LocationEditScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A10226B2C551EC500B84627 /* LocationEditScreen.swift */; };
|
||||
7A10226E2C551EE000B84627 /* LocationEditViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A10226D2C551EE000B84627 /* LocationEditViewModel.swift */; };
|
||||
7A1022772C557EC400B84627 /* LocationPickerScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A1022762C557EC400B84627 /* LocationPickerScreen.swift */; };
|
||||
@ -154,6 +160,13 @@
|
||||
7ACBB91E2CB9B155005A5168 /* Mockable in Frameworks */ = {isa = PBXBuildFile; productRef = 7ACBB91D2CB9B155005A5168 /* Mockable */; };
|
||||
7ACBB9202CB9B16C005A5168 /* Mockable in Frameworks */ = {isa = PBXBuildFile; productRef = 7ACBB91F2CB9B16C005A5168 /* Mockable */; };
|
||||
7AD176B02DC127540023049D /* PNButtonType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AD176AF2DC127540023049D /* PNButtonType.swift */; };
|
||||
7AD8571E2DF8700F009E4B72 /* SDVehicleOwnershipPeriod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AD8571D2DF8700F009E4B72 /* SDVehicleOwnershipPeriod.swift */; };
|
||||
7AD857202DF874F8009E4B72 /* SDVehicleEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AD8571F2DF874F8009E4B72 /* SDVehicleEvent.swift */; };
|
||||
7AD857222DF875B2009E4B72 /* SDOsago.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AD857212DF875B2009E4B72 /* SDOsago.swift */; };
|
||||
7AD857242DF87637009E4B72 /* SDVehicleAd.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AD857232DF87637009E4B72 /* SDVehicleAd.swift */; };
|
||||
7AD857262DF876C9009E4B72 /* SDVehicleNote.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AD857252DF876C9009E4B72 /* SDVehicleNote.swift */; };
|
||||
7AD857282DF87733009E4B72 /* SDDebugInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AD857272DF87733009E4B72 /* SDDebugInfo.swift */; };
|
||||
7AD8572A2DF87928009E4B72 /* SDAudioRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AD857292DF87928009E4B72 /* SDAudioRecord.swift */; };
|
||||
7ADCBC572DB51739002522C0 /* AutoCatApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ADCBC562DB51739002522C0 /* AutoCatApp.swift */; };
|
||||
7ADF6C99250F872C00F237B2 /* RoadNumbers.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7ADF6C98250F872C00F237B2 /* RoadNumbers.otf */; };
|
||||
7ADF6CA12512244400F237B2 /* MapExt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ADF6CA02512244400F237B2 /* MapExt.swift */; };
|
||||
@ -252,6 +265,12 @@
|
||||
7A06E0AD2C7065C7005731AC /* SettingsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewModel.swift; sourceTree = "<group>"; };
|
||||
7A06E0B22C707E13005731AC /* SettingsServiceProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsServiceProtocol.swift; sourceTree = "<group>"; };
|
||||
7A06E0B42C707E2B005731AC /* SettingsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsService.swift; sourceTree = "<group>"; };
|
||||
7A0818712DF83CF0000219FE /* SDVehicle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDVehicle.swift; sourceTree = "<group>"; };
|
||||
7A0818732DF83D98000219FE /* SDVehicleBrand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDVehicleBrand.swift; sourceTree = "<group>"; };
|
||||
7A0818752DF83DB4000219FE /* SDVehicleName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDVehicleName.swift; sourceTree = "<group>"; };
|
||||
7A0818772DF84AE4000219FE /* SDVehicleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDVehicleModel.swift; sourceTree = "<group>"; };
|
||||
7A0818792DF84B77000219FE /* SDVehicleEngine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDVehicleEngine.swift; sourceTree = "<group>"; };
|
||||
7A08187D2DF84CE0000219FE /* SDVehiclePhoto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDVehiclePhoto.swift; sourceTree = "<group>"; };
|
||||
7A10226B2C551EC500B84627 /* LocationEditScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationEditScreen.swift; sourceTree = "<group>"; };
|
||||
7A10226D2C551EE000B84627 /* LocationEditViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationEditViewModel.swift; sourceTree = "<group>"; };
|
||||
7A1022762C557EC400B84627 /* LocationPickerScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationPickerScreen.swift; sourceTree = "<group>"; };
|
||||
@ -406,6 +425,13 @@
|
||||
7AC44B812DB390B900ADC026 /* MainTabScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabScreen.swift; sourceTree = "<group>"; };
|
||||
7AC8B2752D6A01C700190706 /* UISearchTextField+Dumb.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UISearchTextField+Dumb.swift"; sourceTree = "<group>"; };
|
||||
7AD176AF2DC127540023049D /* PNButtonType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PNButtonType.swift; sourceTree = "<group>"; };
|
||||
7AD8571D2DF8700F009E4B72 /* SDVehicleOwnershipPeriod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDVehicleOwnershipPeriod.swift; sourceTree = "<group>"; };
|
||||
7AD8571F2DF874F8009E4B72 /* SDVehicleEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDVehicleEvent.swift; sourceTree = "<group>"; };
|
||||
7AD857212DF875B2009E4B72 /* SDOsago.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDOsago.swift; sourceTree = "<group>"; };
|
||||
7AD857232DF87637009E4B72 /* SDVehicleAd.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDVehicleAd.swift; sourceTree = "<group>"; };
|
||||
7AD857252DF876C9009E4B72 /* SDVehicleNote.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDVehicleNote.swift; sourceTree = "<group>"; };
|
||||
7AD857272DF87733009E4B72 /* SDDebugInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDebugInfo.swift; sourceTree = "<group>"; };
|
||||
7AD857292DF87928009E4B72 /* SDAudioRecord.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDAudioRecord.swift; sourceTree = "<group>"; };
|
||||
7ADCBC562DB51739002522C0 /* AutoCatApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoCatApp.swift; sourceTree = "<group>"; };
|
||||
7ADF6C98250F872C00F237B2 /* RoadNumbers.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = RoadNumbers.otf; sourceTree = "<group>"; };
|
||||
7ADF6CA02512244400F237B2 /* MapExt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapExt.swift; sourceTree = "<group>"; };
|
||||
@ -515,6 +541,26 @@
|
||||
path = SettingsService;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7A0818702DF82B8C000219FE /* SwiftData */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7A0818712DF83CF0000219FE /* SDVehicle.swift */,
|
||||
7A0818732DF83D98000219FE /* SDVehicleBrand.swift */,
|
||||
7A0818752DF83DB4000219FE /* SDVehicleName.swift */,
|
||||
7A0818772DF84AE4000219FE /* SDVehicleModel.swift */,
|
||||
7A0818792DF84B77000219FE /* SDVehicleEngine.swift */,
|
||||
7A08187D2DF84CE0000219FE /* SDVehiclePhoto.swift */,
|
||||
7AD8571D2DF8700F009E4B72 /* SDVehicleOwnershipPeriod.swift */,
|
||||
7AD8571F2DF874F8009E4B72 /* SDVehicleEvent.swift */,
|
||||
7AD857212DF875B2009E4B72 /* SDOsago.swift */,
|
||||
7AD857232DF87637009E4B72 /* SDVehicleAd.swift */,
|
||||
7AD857252DF876C9009E4B72 /* SDVehicleNote.swift */,
|
||||
7AD857272DF87733009E4B72 /* SDDebugInfo.swift */,
|
||||
7AD857292DF87928009E4B72 /* SDAudioRecord.swift */,
|
||||
);
|
||||
path = SwiftData;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7A10226A2C551EA200B84627 /* LocationEditScreen */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -589,6 +635,7 @@
|
||||
7A11474523FF2A9000B424AF /* Models */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7A0818702DF82B8C000219FE /* SwiftData */,
|
||||
7A5D84BA2C1AD80400C2209B /* Realm */,
|
||||
7A64A2042C19DA2D00284124 /* Protocols */,
|
||||
7A64A2012C19D99D00284124 /* DTO */,
|
||||
@ -1426,6 +1473,7 @@
|
||||
7ABDA8092D8710F80083C715 /* AutoCancellable.swift in Sources */,
|
||||
7A5D84C02C1AE4DC00C2209B /* VehicleEngine.swift in Sources */,
|
||||
7AB0EF812C5CC0FE00291EE6 /* SwiftLocationProtocol.swift in Sources */,
|
||||
7AD857242DF87637009E4B72 /* SDVehicleAd.swift in Sources */,
|
||||
7AF6D2282677C2DC0086EA64 /* Constants.swift in Sources */,
|
||||
7A64A2182C19E64800284124 /* VehicleOwnershipPeriodDto.swift in Sources */,
|
||||
7ABDA8052D8705210083C715 /* VehicleRecordServiceProtocol.swift in Sources */,
|
||||
@ -1440,23 +1488,29 @@
|
||||
7A64A2262C1A32C800284124 /* AudioRecordDto.swift in Sources */,
|
||||
7A761C09267E8EE40005F28F /* Base64FS.swift in Sources */,
|
||||
7A64A21E2C19E8D500284124 /* VehicleAdDto.swift in Sources */,
|
||||
7AD857202DF874F8009E4B72 /* SDVehicleEvent.swift in Sources */,
|
||||
7AF6D2202677C1680086EA64 /* Filter.swift in Sources */,
|
||||
7A761C042677F18E0005F28F /* ApiService.swift in Sources */,
|
||||
7A95197B2D80B41600E69883 /* AudioRecordServiceProtocol.swift in Sources */,
|
||||
7AF6D21C2677C1680086EA64 /* DebugInfo.swift in Sources */,
|
||||
7A0818762DF83DB4000219FE /* SDVehicleName.swift in Sources */,
|
||||
7ABDA80D2D8721B10083C715 /* Substrings.swift in Sources */,
|
||||
7A2A8F772DEF205A00FC0AE2 /* VehicleNumberType.swift in Sources */,
|
||||
7AF6D2142677C1680086EA64 /* VehicleEvent.swift in Sources */,
|
||||
7A0818742DF83D98000219FE /* SDVehicleBrand.swift in Sources */,
|
||||
7A64A2102C19E1EB00284124 /* VehicleBrandDto.swift in Sources */,
|
||||
7A599C392C18B22900D47C18 /* FbRefreshTokenModel.swift in Sources */,
|
||||
7AF6D2172677C1680086EA64 /* VehicleRegion.swift in Sources */,
|
||||
7A6F096026DBF588003A965D /* VehicleNote.swift in Sources */,
|
||||
7AF6D21E2677C1680086EA64 /* PlateNumber.swift in Sources */,
|
||||
7A5D84C62C1AE72E00C2209B /* VehicleName.swift in Sources */,
|
||||
7AD8572A2DF87928009E4B72 /* SDAudioRecord.swift in Sources */,
|
||||
7AD8571E2DF8700F009E4B72 /* SDVehicleOwnershipPeriod.swift in Sources */,
|
||||
7A64A2122C19E2A100284124 /* VehicleModelDto.swift in Sources */,
|
||||
7ABDA80B2D8715DC0083C715 /* VehicleRecordError.swift in Sources */,
|
||||
7A06E0B32C707E13005731AC /* SettingsServiceProtocol.swift in Sources */,
|
||||
7A06E0B52C707E2B005731AC /* SettingsService.swift in Sources */,
|
||||
7AD857282DF87733009E4B72 /* SDDebugInfo.swift in Sources */,
|
||||
7AF6D21F2677C1680086EA64 /* Response.swift in Sources */,
|
||||
7AA515D02D9ABCC800EB3418 /* RecordPlayerService.swift in Sources */,
|
||||
7A60D24D2C5A9D4900D13F7B /* LocationService.swift in Sources */,
|
||||
@ -1464,22 +1518,28 @@
|
||||
7A761C07267E8E7F0005F28F /* AnyEncodable.swift in Sources */,
|
||||
7A64A2032C19DA1000284124 /* VehicleDto.swift in Sources */,
|
||||
7AB4E4332D3C21C00006D052 /* FileManagerExt.swift in Sources */,
|
||||
7AD857262DF876C9009E4B72 /* SDVehicleNote.swift in Sources */,
|
||||
7A9519792D80B3E800E69883 /* AudioRecordService.swift in Sources */,
|
||||
7AB587322C42D38E00FA7B66 /* StorageServiceProtocol.swift in Sources */,
|
||||
7A08187E2DF84CE0000219FE /* SDVehiclePhoto.swift in Sources */,
|
||||
7AB4E43B2D3D3F4F0006D052 /* VehicleServiceProtocol.swift in Sources */,
|
||||
7AA514E02D0B75B3001CAC50 /* StorageService+Events.swift in Sources */,
|
||||
7A64A2222C19E99E00284124 /* DebugInfoDto.swift in Sources */,
|
||||
7A5D84BC2C1AD81000C2209B /* VehicleOwnershipPeriod.swift in Sources */,
|
||||
7A0818722DF83CF0000219FE /* SDVehicle.swift in Sources */,
|
||||
7A64A2202C19E93500284124 /* VehicleNoteDto.swift in Sources */,
|
||||
7AF6D21A2677C1680086EA64 /* User.swift in Sources */,
|
||||
7A60D2512C5A9E4200D13F7B /* GeocoderProtocol.swift in Sources */,
|
||||
7AB4E4382D3D0C5C0006D052 /* VehiclesArchive.swift in Sources */,
|
||||
7A64A21C2C19E87B00284124 /* OsagoDto.swift in Sources */,
|
||||
7AA515D22D9ABCE600EB3418 /* RecordPlayerServiceProtocol.swift in Sources */,
|
||||
7A0818782DF84AE4000219FE /* SDVehicleModel.swift in Sources */,
|
||||
7A08187A2DF84B77000219FE /* SDVehicleEngine.swift in Sources */,
|
||||
7AA515DA2D9ADEF000EB3418 /* StorageError.swift in Sources */,
|
||||
7A809F392D66755B00CF1B3C /* Error+Canceled.swift in Sources */,
|
||||
7AF6D21D2677C1680086EA64 /* Osago.swift in Sources */,
|
||||
7A1CF81629A42117007962DA /* Realm.swift in Sources */,
|
||||
7AD857222DF875B2009E4B72 /* SDOsago.swift in Sources */,
|
||||
7ABDA80F2D8723F90083C715 /* StorageService+AudioRecords.swift in Sources */,
|
||||
7A64A2142C19E3B700284124 /* VehicleEngineDto.swift in Sources */,
|
||||
7A761C052677F1BC0005F28F /* CocoaError.swift in Sources */,
|
||||
|
||||
41
AutoCatCore/Models/SwiftData/SDAudioRecord.swift
Normal file
41
AutoCatCore/Models/SwiftData/SDAudioRecord.swift
Normal file
@ -0,0 +1,41 @@
|
||||
//
|
||||
// SDAudioRecord.swift
|
||||
// AutoCatCore
|
||||
//
|
||||
// Created by Selim Mustafaev on 10.06.2025.
|
||||
// Copyright © 2025 Selim Mustafaev. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftData
|
||||
|
||||
@Model
|
||||
final class SDAudioRecord {
|
||||
|
||||
@Attribute(.unique)
|
||||
var path: String
|
||||
|
||||
var number: String?
|
||||
var rawText: String
|
||||
var addedDate: TimeInterval
|
||||
var duration: TimeInterval
|
||||
|
||||
@Relationship(deleteRule: .cascade)
|
||||
var event: SDVehicleEvent?
|
||||
|
||||
init(
|
||||
path: String,
|
||||
number: String? = nil,
|
||||
rawText: String,
|
||||
addedDate: TimeInterval,
|
||||
duration: TimeInterval,
|
||||
event: SDVehicleEvent? = nil
|
||||
) {
|
||||
self.path = path
|
||||
self.number = number
|
||||
self.rawText = rawText
|
||||
self.addedDate = addedDate
|
||||
self.duration = duration
|
||||
self.event = event
|
||||
}
|
||||
}
|
||||
47
AutoCatCore/Models/SwiftData/SDDebugInfo.swift
Normal file
47
AutoCatCore/Models/SwiftData/SDDebugInfo.swift
Normal file
@ -0,0 +1,47 @@
|
||||
//
|
||||
// SDDebugInfo.swift
|
||||
// AutoCatCore
|
||||
//
|
||||
// Created by Selim Mustafaev on 10.06.2025.
|
||||
// Copyright © 2025 Selim Mustafaev. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftData
|
||||
|
||||
@Model
|
||||
final class SDDebugInfo {
|
||||
|
||||
@Relationship(deleteRule: .cascade) var autocod: SDDebugInfoEntry?
|
||||
@Relationship(deleteRule: .cascade) var vin01vin: SDDebugInfoEntry?
|
||||
@Relationship(deleteRule: .cascade) var vin01base: SDDebugInfoEntry?
|
||||
@Relationship(deleteRule: .cascade) var vin01history: SDDebugInfoEntry?
|
||||
@Relationship(deleteRule: .cascade) var nomerogram: SDDebugInfoEntry?
|
||||
|
||||
init(
|
||||
autocod: SDDebugInfoEntry? = nil,
|
||||
vin01vin: SDDebugInfoEntry? = nil,
|
||||
vin01base: SDDebugInfoEntry? = nil,
|
||||
vin01history: SDDebugInfoEntry? = nil,
|
||||
nomerogram: SDDebugInfoEntry? = nil
|
||||
) {
|
||||
self.autocod = autocod
|
||||
self.vin01vin = vin01vin
|
||||
self.vin01base = vin01base
|
||||
self.vin01history = vin01history
|
||||
self.nomerogram = nomerogram
|
||||
}
|
||||
}
|
||||
|
||||
@Model
|
||||
final class SDDebugInfoEntry {
|
||||
|
||||
var fields: Int64
|
||||
var error: String?
|
||||
var status: Int
|
||||
|
||||
init(fields: Int64, error: String? = nil, status: Int) {
|
||||
self.fields = fields
|
||||
self.error = error
|
||||
self.status = status
|
||||
}
|
||||
}
|
||||
52
AutoCatCore/Models/SwiftData/SDOsago.swift
Normal file
52
AutoCatCore/Models/SwiftData/SDOsago.swift
Normal file
@ -0,0 +1,52 @@
|
||||
//
|
||||
// SDOsago.swift
|
||||
// AutoCatCore
|
||||
//
|
||||
// Created by Selim Mustafaev on 10.06.2025.
|
||||
// Copyright © 2025 Selim Mustafaev. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftData
|
||||
|
||||
@Model
|
||||
final class SDOsago {
|
||||
|
||||
var date: TimeInterval
|
||||
var number: String
|
||||
var vin: String?
|
||||
var plateNumber: String?
|
||||
var name: String
|
||||
var status: String?
|
||||
var restrictions: String
|
||||
var insurant: String?
|
||||
var owner: String?
|
||||
var usageRegion: String?
|
||||
var birthday: String?
|
||||
|
||||
init(
|
||||
date: TimeInterval,
|
||||
number: String,
|
||||
vin: String? = nil,
|
||||
plateNumber: String? = nil,
|
||||
name: String,
|
||||
status: String? = nil,
|
||||
restrictions: String,
|
||||
insurant: String? = nil,
|
||||
owner: String? = nil,
|
||||
usageRegion: String? = nil,
|
||||
birthday: String? = nil
|
||||
) {
|
||||
self.date = date
|
||||
self.number = number
|
||||
self.vin = vin
|
||||
self.plateNumber = plateNumber
|
||||
self.name = name
|
||||
self.status = status
|
||||
self.restrictions = restrictions
|
||||
self.insurant = insurant
|
||||
self.owner = owner
|
||||
self.usageRegion = usageRegion
|
||||
self.birthday = birthday
|
||||
}
|
||||
}
|
||||
118
AutoCatCore/Models/SwiftData/SDVehicle.swift
Normal file
118
AutoCatCore/Models/SwiftData/SDVehicle.swift
Normal file
@ -0,0 +1,118 @@
|
||||
//
|
||||
// SDVehicle.swift
|
||||
// AutoCatCore
|
||||
//
|
||||
// Created by Selim Mustafaev on 10.06.2025.
|
||||
// Copyright © 2025 Selim Mustafaev. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftData
|
||||
|
||||
@Model
|
||||
final class SDVehicle {
|
||||
|
||||
@Relationship(deleteRule: .cascade)
|
||||
var brand: SDVehicleBrand?
|
||||
|
||||
@Relationship(deleteRule: .cascade)
|
||||
var model: SDVehicleModel?
|
||||
|
||||
var color: String?
|
||||
var year: Int
|
||||
var category: String?
|
||||
|
||||
@Relationship(deleteRule: .cascade)
|
||||
var engine: SDVehicleEngine?
|
||||
|
||||
@Attribute(.unique)
|
||||
var number: String
|
||||
|
||||
var currentNumber: String?
|
||||
var vin1: String?
|
||||
var vin2: String?
|
||||
var sts: String?
|
||||
var pts: String?
|
||||
var isRightWheel: Bool?
|
||||
var isJapanese: Bool?
|
||||
var addedDate: TimeInterval
|
||||
var updatedDate: TimeInterval
|
||||
var addedBy: String
|
||||
|
||||
@Relationship(deleteRule: .cascade)
|
||||
var photos: [SDVehiclePhoto]
|
||||
|
||||
@Relationship(deleteRule: .cascade)
|
||||
var ownershipPeriods: [SDVehicleOwnershipPeriod]
|
||||
|
||||
@Relationship(deleteRule: .cascade)
|
||||
var events: [SDVehicleEvent]
|
||||
|
||||
@Relationship(deleteRule: .cascade)
|
||||
var osagoContracts: [SDOsago]
|
||||
|
||||
@Relationship(deleteRule: .cascade)
|
||||
var ads: [SDVehicleAd]
|
||||
|
||||
@Relationship(deleteRule: .cascade)
|
||||
var notes: [SDVehicleNote]
|
||||
|
||||
@Relationship(deleteRule: .cascade)
|
||||
var debugInfo: SDDebugInfo?
|
||||
|
||||
var synchronized: Bool
|
||||
|
||||
init(
|
||||
brand: SDVehicleBrand? = nil,
|
||||
model: SDVehicleModel? = nil,
|
||||
color: String? = nil,
|
||||
year: Int,
|
||||
category: String? = nil,
|
||||
engine: SDVehicleEngine? = nil,
|
||||
number: String,
|
||||
currentNumber: String? = nil,
|
||||
vin1: String? = nil,
|
||||
vin2: String? = nil,
|
||||
sts: String? = nil,
|
||||
pts: String? = nil,
|
||||
isRightWheel: Bool? = nil,
|
||||
isJapanese: Bool? = nil,
|
||||
addedDate: TimeInterval,
|
||||
updatedDate: TimeInterval,
|
||||
addedBy: String,
|
||||
photos: [SDVehiclePhoto],
|
||||
ownershipPeriods: [SDVehicleOwnershipPeriod],
|
||||
events: [SDVehicleEvent],
|
||||
osagoContracts: [SDOsago],
|
||||
ads: [SDVehicleAd],
|
||||
notes: [SDVehicleNote],
|
||||
debugInfo: SDDebugInfo? = nil,
|
||||
synchronized: Bool
|
||||
) {
|
||||
self.brand = brand
|
||||
self.model = model
|
||||
self.color = color
|
||||
self.year = year
|
||||
self.category = category
|
||||
self.engine = engine
|
||||
self.number = number
|
||||
self.currentNumber = currentNumber
|
||||
self.vin1 = vin1
|
||||
self.vin2 = vin2
|
||||
self.sts = sts
|
||||
self.pts = pts
|
||||
self.isRightWheel = isRightWheel
|
||||
self.isJapanese = isJapanese
|
||||
self.addedDate = addedDate
|
||||
self.updatedDate = updatedDate
|
||||
self.addedBy = addedBy
|
||||
self.photos = photos
|
||||
self.ownershipPeriods = ownershipPeriods
|
||||
self.events = events
|
||||
self.osagoContracts = osagoContracts
|
||||
self.ads = ads
|
||||
self.notes = notes
|
||||
self.debugInfo = debugInfo
|
||||
self.synchronized = synchronized
|
||||
}
|
||||
}
|
||||
46
AutoCatCore/Models/SwiftData/SDVehicleAd.swift
Normal file
46
AutoCatCore/Models/SwiftData/SDVehicleAd.swift
Normal file
@ -0,0 +1,46 @@
|
||||
//
|
||||
// SDVehicleAd.swift
|
||||
// AutoCatCore
|
||||
//
|
||||
// Created by Selim Mustafaev on 10.06.2025.
|
||||
// Copyright © 2025 Selim Mustafaev. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftData
|
||||
|
||||
@Model
|
||||
final class SDVehicleAd {
|
||||
|
||||
var id: Int
|
||||
var url: String?
|
||||
var price: String?
|
||||
var date: TimeInterval
|
||||
var mileage: String?
|
||||
var region: String?
|
||||
var city: String?
|
||||
var adDescription: String?
|
||||
var photos: [String]
|
||||
|
||||
init(
|
||||
id: Int,
|
||||
url: String? = nil,
|
||||
price: String? = nil,
|
||||
date: TimeInterval,
|
||||
mileage: String? = nil,
|
||||
region: String? = nil,
|
||||
city: String? = nil,
|
||||
adDescription: String? = nil,
|
||||
photos: [String]
|
||||
) {
|
||||
self.id = id
|
||||
self.url = url
|
||||
self.price = price
|
||||
self.date = date
|
||||
self.mileage = mileage
|
||||
self.region = region
|
||||
self.city = city
|
||||
self.adDescription = adDescription
|
||||
self.photos = photos
|
||||
}
|
||||
}
|
||||
22
AutoCatCore/Models/SwiftData/SDVehicleBrand.swift
Normal file
22
AutoCatCore/Models/SwiftData/SDVehicleBrand.swift
Normal file
@ -0,0 +1,22 @@
|
||||
//
|
||||
// SDVehicleBrand.swift
|
||||
// AutoCatCore
|
||||
//
|
||||
// Created by Selim Mustafaev on 10.06.2025.
|
||||
// Copyright © 2025 Selim Mustafaev. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftData
|
||||
|
||||
@Model
|
||||
final class SDVehicleBrand {
|
||||
|
||||
@Relationship(deleteRule: .cascade)
|
||||
var name: SDVehicleName?
|
||||
var logo: String?
|
||||
|
||||
init(name: SDVehicleName? = nil, logo: String? = nil) {
|
||||
self.name = name
|
||||
self.logo = logo
|
||||
}
|
||||
}
|
||||
33
AutoCatCore/Models/SwiftData/SDVehicleEngine.swift
Normal file
33
AutoCatCore/Models/SwiftData/SDVehicleEngine.swift
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// SDVehicleEngine.swift
|
||||
// AutoCatCore
|
||||
//
|
||||
// Created by Selim Mustafaev on 10.06.2025.
|
||||
// Copyright © 2025 Selim Mustafaev. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftData
|
||||
|
||||
@Model
|
||||
final class SDVehicleEngine {
|
||||
|
||||
var number: String?
|
||||
var volume: Int?
|
||||
var powerHp: Float?
|
||||
var powerKw: Float?
|
||||
var fuelType: String?
|
||||
|
||||
init(
|
||||
number: String? = nil,
|
||||
volume: Int? = nil,
|
||||
powerHp: Float? = nil,
|
||||
powerKw: Float? = nil,
|
||||
fuelType: String? = nil
|
||||
) {
|
||||
self.number = number
|
||||
self.volume = volume
|
||||
self.powerHp = powerHp
|
||||
self.powerKw = powerKw
|
||||
self.fuelType = fuelType
|
||||
}
|
||||
}
|
||||
39
AutoCatCore/Models/SwiftData/SDVehicleEvent.swift
Normal file
39
AutoCatCore/Models/SwiftData/SDVehicleEvent.swift
Normal file
@ -0,0 +1,39 @@
|
||||
//
|
||||
// SDVehicleEvent.swift
|
||||
// AutoCatCore
|
||||
//
|
||||
// Created by Selim Mustafaev on 10.06.2025.
|
||||
// Copyright © 2025 Selim Mustafaev. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftData
|
||||
|
||||
@Model
|
||||
final class SDVehicleEvent {
|
||||
|
||||
@Attribute(.unique)
|
||||
var id: String
|
||||
|
||||
var date: TimeInterval
|
||||
var latitude: Double
|
||||
var longitude: Double
|
||||
var address: String?
|
||||
var addedBy: String?
|
||||
|
||||
init(
|
||||
id: String,
|
||||
date: TimeInterval,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
address: String? = nil,
|
||||
addedBy: String? = nil
|
||||
) {
|
||||
self.id = id
|
||||
self.date = date
|
||||
self.latitude = latitude
|
||||
self.longitude = longitude
|
||||
self.address = address
|
||||
self.addedBy = addedBy
|
||||
}
|
||||
}
|
||||
20
AutoCatCore/Models/SwiftData/SDVehicleModel.swift
Normal file
20
AutoCatCore/Models/SwiftData/SDVehicleModel.swift
Normal file
@ -0,0 +1,20 @@
|
||||
//
|
||||
// SDVehicleModel.swift
|
||||
// AutoCatCore
|
||||
//
|
||||
// Created by Selim Mustafaev on 10.06.2025.
|
||||
// Copyright © 2025 Selim Mustafaev. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftData
|
||||
|
||||
@Model
|
||||
final class SDVehicleModel {
|
||||
|
||||
@Relationship(deleteRule: .cascade)
|
||||
var name: SDVehicleName?
|
||||
|
||||
init(name: SDVehicleName? = nil) {
|
||||
self.name = name
|
||||
}
|
||||
}
|
||||
21
AutoCatCore/Models/SwiftData/SDVehicleName.swift
Normal file
21
AutoCatCore/Models/SwiftData/SDVehicleName.swift
Normal file
@ -0,0 +1,21 @@
|
||||
//
|
||||
// SDVehicleName.swift
|
||||
// AutoCatCore
|
||||
//
|
||||
// Created by Selim Mustafaev on 10.06.2025.
|
||||
// Copyright © 2025 Selim Mustafaev. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftData
|
||||
|
||||
@Model
|
||||
final class SDVehicleName {
|
||||
|
||||
var original: String?
|
||||
var normalized: String?
|
||||
|
||||
init(original: String? = nil, normalized: String? = nil) {
|
||||
self.original = original
|
||||
self.normalized = normalized
|
||||
}
|
||||
}
|
||||
33
AutoCatCore/Models/SwiftData/SDVehicleNote.swift
Normal file
33
AutoCatCore/Models/SwiftData/SDVehicleNote.swift
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// SDVehicleNote.swift
|
||||
// AutoCatCore
|
||||
//
|
||||
// Created by Selim Mustafaev on 10.06.2025.
|
||||
// Copyright © 2025 Selim Mustafaev. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftData
|
||||
|
||||
@Model
|
||||
final class SDVehicleNote {
|
||||
|
||||
@Attribute(.unique)
|
||||
var id: String
|
||||
|
||||
var user: String
|
||||
var date: TimeInterval
|
||||
var text: String
|
||||
|
||||
init(
|
||||
id: String,
|
||||
user: String,
|
||||
date: TimeInterval,
|
||||
text: String
|
||||
) {
|
||||
self.id = id
|
||||
self.user = user
|
||||
self.date = date
|
||||
self.text = text
|
||||
}
|
||||
}
|
||||
51
AutoCatCore/Models/SwiftData/SDVehicleOwnershipPeriod.swift
Normal file
51
AutoCatCore/Models/SwiftData/SDVehicleOwnershipPeriod.swift
Normal file
@ -0,0 +1,51 @@
|
||||
//
|
||||
// SDVehicleOwnershipPeriod.swift
|
||||
// AutoCatCore
|
||||
//
|
||||
// Created by Selim Mustafaev on 10.06.2025.
|
||||
// Copyright © 2025 Selim Mustafaev. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftData
|
||||
|
||||
@Model
|
||||
final class SDVehicleOwnershipPeriod {
|
||||
|
||||
var lastOperation: String
|
||||
var ownerType: String
|
||||
var from: Int64
|
||||
var to: Int64
|
||||
var region: String?
|
||||
var registrationRegion: String?
|
||||
var locality: String?
|
||||
var code: String?
|
||||
var street: String?
|
||||
var building: String?
|
||||
var inn: String?
|
||||
|
||||
init(
|
||||
lastOperation: String,
|
||||
ownerType: String,
|
||||
from: Int64,
|
||||
to: Int64,
|
||||
region: String? = nil,
|
||||
registrationRegion: String? = nil,
|
||||
locality: String? = nil,
|
||||
code: String? = nil,
|
||||
street: String? = nil,
|
||||
building: String? = nil,
|
||||
inn: String? = nil
|
||||
) {
|
||||
self.lastOperation = lastOperation
|
||||
self.ownerType = ownerType
|
||||
self.from = from
|
||||
self.to = to
|
||||
self.region = region
|
||||
self.registrationRegion = registrationRegion
|
||||
self.locality = locality
|
||||
self.code = code
|
||||
self.street = street
|
||||
self.building = building
|
||||
self.inn = inn
|
||||
}
|
||||
}
|
||||
31
AutoCatCore/Models/SwiftData/SDVehiclePhoto.swift
Normal file
31
AutoCatCore/Models/SwiftData/SDVehiclePhoto.swift
Normal file
@ -0,0 +1,31 @@
|
||||
//
|
||||
// SDVehiclePhoto.swift
|
||||
// AutoCatCore
|
||||
//
|
||||
// Created by Selim Mustafaev on 10.06.2025.
|
||||
// Copyright © 2025 Selim Mustafaev. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftData
|
||||
|
||||
@Model
|
||||
final class SDVehiclePhoto {
|
||||
|
||||
var brand: String?
|
||||
var model: String?
|
||||
var date: TimeInterval
|
||||
var url: String
|
||||
|
||||
init(
|
||||
brand: String? = nil,
|
||||
model: String? = nil,
|
||||
date: TimeInterval,
|
||||
url: String
|
||||
) {
|
||||
self.brand = brand
|
||||
self.model = model
|
||||
self.date = date
|
||||
self.url = url
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user