-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Youssef2 #8
base: master
Are you sure you want to change the base?
Youssef2 #8
Conversation
migration and .env and search
Creation of Tables and their services, and controllers
Creation of festival table and movie_festival junction table
Modified the date formatting to show only the year instead of the whole timestamp for the Movie on the frontend
Added Genre, Overview, Language, Duration and writer relation to movie entity Added type to director entity to make the director entity either writer or director and updated dtos accordingly for both.
created the writer type in the director entity and added it to the dtos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a description!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove all unused controller/service methods, only leave endpoints that are covered in the stories
src/entities/movie.entity.ts
Outdated
@CreateDateColumn({ type: 'timestamptz' }) | ||
created_at: Date; | ||
|
||
@UpdateDateColumn({ type: 'timestamptz' }) | ||
updated_at: Date; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
U can create a class called BaseEntity
that has created_at
, updated_at
and uuid
then u can extend this class in all other entities u use instead of duplicating them on every entity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, created base entity and extended it to all needed entities
@ManyToOne(() => Director, director => director.movies) | ||
@JoinColumn({ name: 'director_id' }) | ||
director: Director; | ||
|
||
@ManyToOne(() => Director, writer => writer.movies, { nullable: true }) | ||
@JoinColumn({ name: 'writer_id' }) | ||
writer: Director; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can a writer be of type Director, u need to change Director
entity to movie worker/maker/cast, etc., something generic as now it has a type that identifies the role of this cast member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't fix this to be honest i tried to change it but i could not find all the imports to fix it
src/entities/movie.entity.ts
Outdated
@BeforeInsert() | ||
generateUUID() { | ||
if (!this.uuid) { | ||
this.uuid = uuidv4(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to the base entity too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/entities/movie.entity.ts
Outdated
@Column("text", { array: true, default: [] }) | ||
genres: string[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Genres are usually not something unique that changes with every movie, we can store genre ids instead of recreating genres with every movie, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
src/entities/actor.entity.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have, actor, writer and director, while they all share almost the same attributes, this causes a problem with movie awards as it's tied to actors now, while it's quite popular that an award can be best picture, best story, best screen-play, all of these awards are not given to actor, and we are not going to create a table for each person that might participate in a movie while they all share the same attributes, by the end, they are cast, or movie workers with different jobs
src/entities/director.entity.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss the change that needs to be done to unify the redundancy caused by this table
Fixes and Better Implementation.
Deleted Testing Files
Cleaning the Files
Controllers to handle the http requests
Created the Movie entity and then updated for the second user story to include additional fields and relationships:
Added duration, overview, language, and genres fields.
Added relationships for director, writer, and actors.
Used the initial Director entity to manage both directors and writers by adding a type field (director or writer).
Updated the MovieService to handle all the new relationships and fields
Updated the Movie_actor entity to have a relationship with Movie_award to link the Actor Nominations with the movie and actor and the award.
Created Movie_award entity to give a few attributes to the award and the relationships with the movie_actor to link them together