@jgrenat@bsky.social
Slides : bit.ly/metier-types
True
False
1
12347
2
0.5664908
Infinity
"1"
"JUG Summer Camp"
""
"Elm"
"笑う門 には 福来たる"
"🏖️"
True
False
2 valeurs
L’ensemble des connaissances, règles, processus et concepts spécifiques liés à l’activité
Gestion des processus d'achats au sein de votre entreprise
export type PurchaseRequest = {
items: {
product: Product;
negotiation?: Negotiation;
}[];
customer: Customer;
status: string;
validationDate?: DateTime;
}
export type Product = {
id: string;
name: string;
type: string;
unitPrice: number;
details: any;
}
export type Negotiation = {
type: string;
value: number;
}
export type Customer = {
id: string;
email: string;
address: string;
}
Modélisation
Métier
2
∞
2
Card(modelisation) == Card(business)
export type Negotiation = {
type: 'percentage' | 'fixed';
value: number;
}
export type Negotiation = {
isPercentage: boolean;
value: number;
}
Value Objects
Types algébriques
type Color = "♣︎" | "♥︎" | "♦︎" | "♠︎";
type Rank = "A" | "K" | "Q" // ...
type CardDetails = {
isRed: boolean;
isNumber: boolean;
}
type Card = {
color: Color;
rank: Rank;
}
Type Somme
Type Produit
Type Algébrique
export type Customer = {
id: CustomerId;
email: Email;
address: string;
};
export type Negotiation = {
type: "percentage" | "fixed" | "free";
value: number;
};
export type Product = SaasProduct | PhysicalProduct;
type SaasProduct = {
id: ProductId;
name: string;
type: "saas";
unitPrice: number;
details: {
saasId: SaasId,
subscriptionEnd: PlainDate,
billingQuarter: BillingQuarter
};
};
type PhysicalProduct = {
id: ProductId;
name: string;
type: "physical";
unitPrice: number;
details: { itemId: ItemId; count: number };
};
export type PurchaseRequest = DraftPurchaseRequest
| SentPurchaseRequest | ValidatedPurchaseRequest;
type DraftPurchaseRequest = {
items: PurchaseRequestItem[];
customer?: {
email: string;
address: string;
};
status: "draft";
};
type SentPurchaseRequest = {
items: NonEmptyArray<PurchaseRequestItem>;
customer: Customer;
status: "sent";
};
type ValidatedPurchaseRequest = {
// ...
validationDate: DateTime;
};
export type Currency = "USD" | "EUR";
export type Price<T extends Currency> = {
value: number;
currency: T
};
Ajustez l'équilibre entre
pénibilité et sécurité
@jgrenat@bsky.social
Slides : bit.ly/metier-types
Slides : bit.ly/metier-types
@jgrenat@bsky.social
Slides : bit.ly/metier-types
@jgrenat@bsky.social