( ctx context.Context, chatID uuid.UUID, ownerID uuid.UUID, organizationID uuid.UUID, name string, mediaType string, data []byte, )
| 223 | } |
| 224 | |
| 225 | func (p *Server) storeRecordingArtifact( |
| 226 | ctx context.Context, |
| 227 | chatID uuid.UUID, |
| 228 | ownerID uuid.UUID, |
| 229 | organizationID uuid.UUID, |
| 230 | name string, |
| 231 | mediaType string, |
| 232 | data []byte, |
| 233 | ) (chattool.AttachmentMetadata, error) { |
| 234 | storedName, verifiedMediaType, err := chatfiles.PrepareRecordingArtifact(name, mediaType, data) |
| 235 | if err != nil { |
| 236 | return chattool.AttachmentMetadata{}, err |
| 237 | } |
| 238 | |
| 239 | var attachment chattool.AttachmentMetadata |
| 240 | err = p.db.InTx(func(tx database.Store) error { |
| 241 | var err error |
| 242 | attachment, err = storeLinkedChatFileTx( |
| 243 | ctx, |
| 244 | tx, |
| 245 | chatID, |
| 246 | ownerID, |
| 247 | organizationID, |
| 248 | storedName, |
| 249 | verifiedMediaType, |
| 250 | data, |
| 251 | ) |
| 252 | return err |
| 253 | }, database.DefaultTXOptions().WithID("store_recording_artifact")) |
| 254 | if err != nil { |
| 255 | return chattool.AttachmentMetadata{}, err |
| 256 | } |
| 257 | return attachment, nil |
| 258 | } |
no test coverage detected