Add type for PartView
Reformat model types
Replace calls to handcrafted functions by calls to sqlx package