← The OurPass work04 / OURPASS · CONTRIBUTION

Validation shared by create and update requests.

Make invalid input understandable before it is saved.

Where this work fits

Inventory work needed more than a product name. Price, quantity, category, availability, and publication status described different things, and users needed to create, find, and update those records.

MY CONTRIBUTION

I added validation for product inputs, including numeric and category fields. Update requests reused those rules while allowing partial changes. Invalid field types could be rejected before persistence, with feedback the caller could act on.

THE IDEA, ILLUSTRATED

Check an input before changing a record

VALIDATION · THE REQUEST MUST FIT THE RECORD
UPDATE DESK LAMP

A quantity is a number.

Try “twelve”, then the number 12.

BEFORE PERSISTENCE

Waiting for a request

The DTO defines the expected fields and types.

Request → validation → service
Numeric input is validated before the request can continue.
THE ENGINEERING DECISION

An unpublished product is not an out-of-stock product.

I kept publication and availability as separate fields rather than compressing them into one status. Create and update requests shared validation rules, while partial updates let a user change a field without resubmitting the entire record.

The skills behind the work

NestJS
Organize backend endpoints, validation, and services around product responsibilities.
Validation
Reject invalid or unsupported input before it affects the rest of the application.
TypeScript
Make data shapes and code boundaries explicit while building product behavior.
THE WIDER RESULT

The inventory services supported structured product entry, filtered retrieval, and updates. Businesses could manage those details through defined API operations.

READ THIS IN CONTEXTI built APIs for the details a business manages every day. →
Related contributionsStructured product recordsI contributed product-record APIs using NestJS, TypeORM, and PostgreSQL. The records kept price, quantity, category, availability, and publication status distinct, so updates could describe what had actually changed about a product.Filtering the inventory catalogueI built inventory filtering by product name, category, item type, and publication status. The query combined the supplied filters, allowing users to narrow the records returned without filling every search field.Retrieving and updating product informationI built inventory retrieval, update, and deletion operations. Partial updates let the caller change supplied fields, and the service included record-ownership checks around those operations.