Skip to content

Instantly share code, notes, and snippets.

View sam-n-johnston's full-sized avatar

Sam-Nicolai Johnston sam-n-johnston

View GitHub Profile
@sam-n-johnston
sam-n-johnston / Order.ts
Last active January 30, 2024 23:41
Implementing an Event-Sourced System
class Order {
public id: string;
// Used to keep track of new events for this aggregate
private _events: Event[] = [];
private version: number = -1;
private shippingAddress: Address;
private billingAddress: Address;
private items: Item[];
private shippingMethod: string;
@sam-n-johnston
sam-n-johnston / DummyImplementation.ts
Last active December 13, 2023 02:09
Improving Delivery with Subtasking
// express http endpoint
app.get('/orders', (req, res) => {
res.send([
{
id: 'smallTotalOrderId',
status: 'shipped',
datePlaced: '2000-10-31T01:30:00.000Z',
total: '0.99',
},
{