mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Swift
		
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Swift
		
	
| // Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
 | |
| 
 | |
| import Foundation
 | |
| import GRDB
 | |
| import SessionUtilitiesKit
 | |
| 
 | |
| public struct InteractionAttachment: Codable, Equatable, FetchableRecord, PersistableRecord, TableRecord, ColumnExpressible {
 | |
|     public static var databaseTableName: String { "interactionAttachment" }
 | |
|     internal static let interactionForeignKey = ForeignKey([Columns.interactionId], to: [Interaction.Columns.id])
 | |
|     internal static let attachmentForeignKey = ForeignKey([Columns.attachmentId], to: [Attachment.Columns.id])
 | |
|     public static let interaction = belongsTo(Interaction.self, using: interactionForeignKey)
 | |
|     internal static let attachment = belongsTo(Attachment.self, using: attachmentForeignKey)
 | |
|     
 | |
|     public typealias Columns = CodingKeys
 | |
|     public enum CodingKeys: String, CodingKey, ColumnExpression {
 | |
|         case albumIndex
 | |
|         case interactionId
 | |
|         case attachmentId
 | |
|     }
 | |
|     
 | |
|     public let albumIndex: Int
 | |
|     public let interactionId: Int64
 | |
|     public let attachmentId: String
 | |
|     
 | |
|     // MARK: - Relationships
 | |
|          
 | |
|     public var interaction: QueryInterfaceRequest<Interaction> {
 | |
|         request(for: InteractionAttachment.interaction)
 | |
|     }
 | |
|     
 | |
|     public var attachment: QueryInterfaceRequest<Attachment> {
 | |
|         request(for: InteractionAttachment.attachment)
 | |
|     }
 | |
|     
 | |
|     // MARK: - Initialization
 | |
|     
 | |
|     public init(
 | |
|         albumIndex: Int,
 | |
|         interactionId: Int64,
 | |
|         attachmentId: String
 | |
|     ) {
 | |
|         self.albumIndex = albumIndex
 | |
|         self.interactionId = interactionId
 | |
|         self.attachmentId = attachmentId
 | |
|     }
 | |
| }
 |