At least 10 questions — mix of concept, syntax, practical, and logic. Score ≥80% (enforced by the API) to save progress.
15 questions · concept 5 · syntax 3 · practical 4 · logic 3
1. What does Notes P2 require? Concept
TypeORM entities with synchronize true so migrations are unnecessary Entities and a migration but no User↔Note relation yet A reviewed migration plus seed data stored only in localStorage TypeORM entities, a reviewed migration, seed data, User↔Note relation, synchronize false
2. How do you prove P2? Syntax
pnpm course:validate-milestone be-notes-p2 before running any migrations pnpm migration:run alone, since the grader only checks the schema pnpm course:validate-milestone be-notes-p2 after migrations and seed exist pnpm course:validate-milestone be-notes-p1 now that persistence exists
3. Why synchronize false? Practical
Schema changes go through reviewed migrations It makes TypeORM read the schema from migrations at every startup It stops TypeORM from validating entities against the database It defers all schema changes to seed scripts instead of migrations
4. What should seed data do? Logic
Run the migrations first, then insert baseline rows in the same file Insert baseline notes/users safely for demos without breaking re-runs Truncate all tables before inserting so demos always start clean Add the author foreign key column and then populate it
5. Why a User↔Note relation? Concept
A join table lets any note be shared across all users equally Notes need an author/owner foreign key for real persistence craft The relation lets TypeORM auto-generate the CreateNoteDto Relations enable synchronize true to manage the schema safely
6. What if a migration was already applied incorrectly? Practical
Edit the applied migration file and re-run it against the database Revert the whole migrations table and regenerate from entities Flip synchronize true once to reconcile the drift, then off again Add a new forward migration — do not casually rewrite applied history
7. Can P2 be proven without notes-practice code? Syntax
No — the grader expects real persistence artifacts in the practice app Yes — a single migration file satisfies the grader without entities Yes — describing the schema in PLATFORM.md is sufficient Yes — running seed.ts against an in-memory Map proves persistence
8. What does the grader look for conceptually? Logic
Entities with synchronize true and a passing seed script Migrations plus JwtAuthGuard protecting the notes routes synchronize false, migrations, seed, and author relation loading A pagination { data, meta } contract on the list endpoint
9. Should notes live only in web localStorage for P2? Concept
No — persist with TypeORM/Postgres in notes-practice Yes — localStorage mirrors the Postgres rows for offline demos Yes — the browser store is the source of truth until P4 adds a DB Yes — TypeORM only starts persisting after the P3 auth milestone
10. Which P2 shortcut is wrong? Practical
Writing a reviewed migration for each schema change Seeding baseline rows with an idempotent script Modeling the author foreign key with @ManyToOne Turning synchronize true so schema changes never need migrations
11. What does this contribute to P2? Concept intermediate
@Entity('notes')
export class Note {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column()
title: string;
}Generates and applies the notes migration automatically Maps the Note entity to a notes table for TypeORM persistence Creates the notes table on startup because of the @Entity decorator Defines the CreateNoteDto used by the controller
12. Why is synchronize:false required for P2? Syntax advanced
TypeOrmModule.forRoot({ url, synchronize: false });It forces TypeORM to load the schema from migration files at boot It prevents entities from being registered with forFeature It makes the seed script responsible for creating tables Schema changes must go through reviewed migrations, not auto-sync
13. What does this add for P2? Practical intermediate
@ManyToOne(() => User)
@JoinColumn({ name: 'author_id' })
author: User;A one-to-many where each user embeds all their notes inline A bidirectional relation that also adds notes[] on User automatically A many-to-many join table between users and notes A User-to-Note relation via an author foreign key
14. Why check findOneBy before saving in the seed? Logic advanced
const existing = await repo.findOneBy({ email });
if (!existing) await repo.save(user);To keep the seed idempotent so re-runs do not duplicate rows To upsert the row by merging changed fields on each run To lock the row so concurrent seeds cannot both insert To load the author relation before saving the note
15. Where does this DDL belong? Concept intermediate
await q.query('ALTER TABLE notes ADD COLUMN author_id uuid');In a reviewed migration, not the seed script In the entity file as a @Column so TypeORM applies it In a repository method that runs it once on module init In the seed script, right after the baseline rows are inserted
Submit quiz Checking your session…