@wearesage/schema
Version:
A flexible schema definition and validation system for TypeScript with multi-database support
39 lines (34 loc) • 763 B
text/typescript
import "reflect-metadata";
import { Entity, Id, Property, OneToOne, OneToMany } from "../..";
import { User } from "./User";
import { CartItem } from "./CartItem";
/**
* A Cart belongs to exactly one User.
* It holds many CartItems.
*/
export class Cart {
id: string;
createdAt: Date;
/**
* One-to-one with User (opposite side of the @OneToOne in User).
*/
user: User;
/**
* A cart can have many CartItems.
* The "inverse" property on CartItem is "cart".
*/
items: CartItem[] = [];
}