stdonnelly / ats-tracking-system

The applicant tracking system tracking system
MIT License
0 stars 0 forks source link

Implement FromRow for job applications #18

Closed stdonnelly closed 1 week ago

stdonnelly commented 1 week ago

Instead of using a map_row function in job_application_repository, implement FromRow for JobApplication and let generics handle conversion. FromRow can be defined on structs if all members are FromValue.

The only value left that wasn't just using the default FromValue implementation in map_row was HumanResponse. There is a derive macro for the trait, but I don't trust how mysql executes that macro. The source code for the macro is difficult to read. The documentation for the macro is also incorrect. There is a required field attribute that has no documentation, and I couldn't figure out how to use the mysql(with) field attribute (which is in the documentation. This is all on top of the fact that the macro also defines Into<Value> for an enum as just its representative integer, which is less stable than going by name.

There were also a little bit of other refactoring. Now all of the functions in job_application_repository just return whatever is returned by the Queryable method, except for insert_new_job_application, which returns the given application. I'm not sure why that even returns anything, the Ok value is never used.

closes #8