@tiboli/types
v0.0.14
Published
Typedefinitions for Tiboli
Maintainers
Readme
TiBoLi Types
Here you can find all the type definitions for TiBoLi. These are all Typescript Definitions using Zod.
Contributing
If you want to Contribute, make sure to follow the Guidelines highlighted in CONTRIBUTING.md
Documentation
The following Zod schemas define the structure of the core data entities and their corresponding creation and update payloads.
Book
Represents a book in the library.
| Field | Type | Description |
| -------- | --------- | ----------------------------- |
| id | integer | Unique identifier of the book |
| title | string | Title of the book |
| author | string | Author of the book |
Variants
BookSchema— Complete book object.BookCreationSchema— Book data for creation. Omitsid.BookUpdateSchema— Partial book update. Requiresid; all other fields are optional.
Copy
Represents a physical copy of a book.
| Field | Type | Description |
| -------- | --------- | ----------------------------------- |
| id | integer | Unique identifier of the copy |
| bookId | integer | ID of the book this copy belongs to |
Variants
CopySchema— Complete copy object.CopyCreationSchema— Copy data for creation. Omitsid.CopyUpdateSchema— Partial copy update. Requiresid; all other fields are optional.
Customer
Represents a customer or borrower in the library.
| Field | Type | Description |
| ---------- | --------- | ----------------------------------- |
| id | integer | Unique identifier of the customer |
| name | string | First name of the customer |
| lastname | string | Last name of the customer |
| email | email | Valid email address of the customer |
Variants
CustomerSchema— Complete customer object.CustomerCreationSchema— Customer data for creation. Omitsid.CustomerUpdateSchema— Partial customer update. Requiresid; all other fields are optional.
Group
Represents a group of customers.
| Field | Type | Description |
| ------ | --------- | ------------------------------ |
| id | integer | Unique identifier of the group |
| name | string | Name of the group |
Variants
GroupSchema— Complete group object.GroupCreationSchema— Group data for creation. Omitsid.GroupUpdateSchema— Partial group update. Requiresid; all other fields are optional.
Loan
Represents a loan of a physical book copy to a customer.
| Field | Type | Description |
| ------------ | --------- | ---------------------------------------- |
| id | integer | Unique identifier of the loan |
| copyId | integer | ID of the borrowed book copy |
| customerId | integer | ID of the customer who borrowed the copy |
| lentDate | date | Date on which the copy was lent |
| dueDate | date | Date on which the copy is due |
| returnDate | date | Date on which the copy was returned |
Variants
LoanSchema— Complete loan object.LoanCreationSchema— Loan data for creation. Omitsid.LoanUpdateSchema— Partial loan update. Requiresid; all other fields are optional.
Schema Variants
All entities follow the same pattern:
EntitySchema
├── EntityCreationSchema
│ └── Omits `id`
└── EntityUpdateSchema
├── Requires `id`
└── Makes all other fields optionalThis allows the schemas to be reused consistently for validating complete entities, creation requests, and partial update requests.
Inferred types
Each of the Schemas get's a Type inferred using z.infer. The types are named Attributes instead of Schemas. For instance.
EntitySchema->EntityAttributesEntityCreationSchema->EntityCreationAttributes
