Harmonize whether job code deserializes objects or just accepts ids

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the object-oriented-programming category.

Last Updated: 2024-04-24

I had a job object to get NotesFile objects ready for sale. I called it with PrepareNoteFilesForSale.perform_later(notes_file)

This failed. When I checked this job's arguments, it expected an ID, not a notes_file instance:

PrepareNoteFilesForSale.perform_later(notes_file.id)

This was in contrast to other parts of the job code in my software, which accepted instances instead of IDs.

Lesson

Harmonize (system wide) whether job code accepts objects or object IDs in order to keep a consistent API.