Skip to content

[CORE-DATA] Create Core Data Models and Schema #114

@DrunkOnJava

Description

@DrunkOnJava

📋 Sub-task of Epic #86

Problem

No Core Data models (.xcdatamodeld) exist in the project. Need to create proper entity definitions.

Required Entities

Item Entity

  • id: UUID
  • name: String
  • brand: String?
  • model: String?
  • category: String (enum raw value)
  • condition: String (enum raw value)
  • quantity: Int32
  • value: Decimal (as NSDecimalNumber)
  • purchasePrice: Decimal?
  • purchaseDate: Date?
  • notes: String?
  • barcode: String?
  • serialNumber: String?
  • tags: Transformable (array of strings)
  • imageIds: Transformable (array of UUIDs)
  • locationId: UUID?
  • warrantyId: UUID?
  • createdAt: Date
  • updatedAt: Date

Location Entity

  • id: UUID
  • name: String
  • type: String (enum raw value)
  • parentId: UUID?
  • customFields: Transformable (dictionary)
  • createdAt: Date
  • updatedAt: Date

Photo Entity

  • id: UUID
  • itemId: UUID
  • imageData: Binary
  • thumbnailData: Binary
  • metadata: Transformable
  • uploadedAt: Date

Receipt Entity

  • id: UUID
  • storeName: String
  • purchaseDate: Date
  • totalAmount: Decimal
  • taxAmount: Decimal?
  • items: Transformable
  • imageData: Binary?
  • ocrText: String?
  • createdAt: Date

Relationships

  • Item -> Location (many-to-one)
  • Item -> Photos (one-to-many)
  • Item -> Receipts (many-to-many)
  • Location -> Location (self-referential for hierarchy)

Migration Strategy

  • Version 1: Initial schema
  • Include lightweight migration support
  • Plan for future CloudKit integration

Acceptance Criteria

  • .xcdatamodeld file created with all entities
  • Proper data types and constraints
  • Relationships configured correctly
  • Indexes on frequently queried fields
  • Migration policy defined
  • NSManagedObject subclasses generated

Metadata

Metadata

Labels

P0Production blocker - must fix immediatelycore-dataCore Data framework relatedenhancementNew feature or requestsub-taskPart of a larger epic

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions