Commit Graph

10 Commits

Author SHA1 Message Date
Maxime Delporte
0824a127b9 Updating internal/data/movies.go to Get a movie from the database. Updating cmd/api/movies.go showMovieHandler method to fetch a movie from a request (using the MovieModel's Get method). 2025-11-07 10:58:58 +01:00
Maxime Delporte
19a844ea2e Updating Insert MovieModel's method inserting a new record in the movies table. Updating createMovieHandler to use Insert MovieModel's method.
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 1m0s
2025-11-06 17:10:33 +01:00
Maxime Delporte
1a658d3063 Updating movies.go with MovieModel: this struct is the gateway between our app and the database. Adding CRUD methods alongside for the Movie object. Creating models.go: this file holds a Models struct wrapping all of our Models. This way, we are able to use in our application struct in our main.go. 2025-11-06 10:41:12 +01:00
Maxime Delporte
6ef731573b Exporting the validation from cmd/api/movies.go to internal/data/movies.go by creating the ValidateMovie method. Updating createMovieHandler to use our new ValidateMovie method.
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 55s
2025-10-28 12:07:04 +01:00
Maxime Delporte
040ace30ad Updating createMovieHandler accepting data.Runtime for the Runtime field. Updating internal/data/runtime.go with the json.Unmarshaler interface to transform our client's runtime string field '%d mins' into a Runtime type format.
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 58s
2025-10-27 20:03:52 +01:00
Maxime Delporte
0f7515e198 Removing string json's parameter from Runtime variable inside Movie's struct. Creating errors.go handling different json's error for our API.
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 54s
2025-10-21 18:55:45 +02:00
Maxime Delporte
bc21c4cf87 Use Runtime type instead of int32 in our Movie struct.
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 54s
2025-10-21 16:29:11 +02:00
Maxime Delporte
cc588a1dc0 Adding 'Advanced JSON Customization' section in the README.md. Creating a runtime type (internal/data/runtime.go) to show how we can customize a JSON field.
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 56s
2025-10-21 16:26:06 +02:00
Maxime Delporte
5ca50c6566 Fixing typo. 2025-10-19 18:08:58 +02:00
Maxime Delporte
9a0cb4db10 Creating Movie struct inside internal/data/movies.go to be used in cmd/api/movies.go. Updating the showMovieHandler with the Movie struct. 2025-10-19 11:03:04 +02:00