Skip to content

feat: implement movie details page and optimize components#9

Merged
jordan-smith721 merged 5 commits intomongodb:developmentfrom
jordan-smith721:front-end-crud
Nov 3, 2025
Merged

feat: implement movie details page and optimize components#9
jordan-smith721 merged 5 commits intomongodb:developmentfrom
jordan-smith721:front-end-crud

Conversation

@jordan-smith721
Copy link
Copy Markdown
Collaborator

@jordan-smith721 jordan-smith721 commented Oct 27, 2025

Adds movie details page which finds a movie by ID. Also adds create, edit, and delete functionality, as well as bulk delete

@jordan-smith721 jordan-smith721 marked this pull request as ready for review October 27, 2025 20:18
Copy link
Copy Markdown
Collaborator

@cbullinger cbullinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looking good! A few questions for you (fyi - i only skimmed most of the actual frontend elements, but they all displayed nicely for me, so 🤷 )

Comment thread server/express/README.md Outdated

## Features

### ✅ Implemented CRUD Operations
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Implemented CRUD Operations
### Implemented CRUD Operations

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed ReadME

Comment thread server/express/README.md Outdated
- **deleteMany()** - Delete multiple movies based on filter criteria
- **findOneAndDelete()** - Find and delete a movie in one atomic operation

### 🔮 Planned Features (Post-MVP)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### 🔮 Planned Features (Post-MVP)
### Planned Features (Post-MVP)

Comment thread server/express/README.md Outdated
Comment on lines +199 to +203
- ✅ MongoDB connection
- ✅ Sample_mflix database exists
- ✅ Required collections (movies, theaters, comments) exist
- ✅ Necessary indexes are created
- ✅ Sample data is present
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- MongoDB connection
- Sample_mflix database exists
- Required collections (movies, theaters, comments) exist
- Necessary indexes are created
- Sample data is present
- MongoDB connection
- Sample_mflix database exists
- Required collections (movies, theaters, comments) exist
- Necessary indexes are created
- Sample data is present

const validateForm = () => {
const newErrors: Record<string, string> = {};

// For batch updates, we only validate if fields have values
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to rephrase this slightly for clarity that we're only validating fields with values if those fields have valid values to validate against? (if that makes sense) e.g. there's no validation for the rating since there's no global standard

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to:
For batch updates, we only validate if a field has a value and if that value must meet certain criteria.

updateData.poster = formData.poster.trim();
}

// Check if there's actually something to update
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Check if there's actually something to update
// Check if user entered anything for the batch update

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and idk if it matters but this validation only applies to the batch update. you can successfully click Update on a single movie without having made any changes (but you can't do the same by batch updating that same single movie)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, added to the edit form as well

/>
</div>

{/* Lists (comma-separated) */}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the placeholders for all these be preceded by e.g., like the rating field?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call!

'use client';

/**
* Add Movie Form Component
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we care about an upper limit on this? currently, you can add infinite movies

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need a limit for now since this is just a "sample"

/>
</div>

{/* Lists (comma-separated) */}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as earlier comment re: adding e.g., to placeholders here

Comment thread client/app/lib/api.ts
*/
export async function updateMoviesBatch(movieIds: string[], updateData: Partial<Movie>): Promise<{ success: boolean; error?: string; matchedCount?: number; modifiedCount?: number }> {
try {
// Create filter to match the movie IDs
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Create filter to match the movie IDs
// Create filter to match the movie IDs
// Note: The server will handle ObjectId conversion

applicable here as well?

Comment thread client/app/movies/page.tsx Outdated
setSuccessMessage('Movie created successfully!');
setShowAddForm(false);

// If we have a movieId, redirect to the new movie's page after a brief delay
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a scenario where we don't have a movieId but the creation was successful?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope! Removed

@jordan-smith721 jordan-smith721 merged commit 0992799 into mongodb:development Nov 3, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants