Framework is a simple library we use to build our application. It is based on Domain Driven Development principles. The goals of that framework are to help with:
- Create applications using domain-oriented principles.
- Create testable and robust applications.
- Work on every platform: mobile, desktop, and web.
Read the docs. Documentation is still in progress, but you can already find some useful information. If you have any questions, feel free to ask them in issues. We will try to answer them as soon as possible.
npm run test
- Run all testsnpm run test:unit
- Run unit testsnpm run test:mutational
- Run mutational tests
import { UuidIdentity, Aggregate, Entity } from '@akdasa-studios/framework/domain/models'
import { QueryBuilder } from '@akdasa-studios/framework/domain/persistence'
// Identities
class OrderId extends UuidIdentity<'Order'> {}
class OrderLineId extends UuidIdentity<'OrderLine'> {}
// Entity
class OrderLine extends Entity<OrderLineId> {
constructor(
public readonly line: string,
public readonly quantity: number,
id?: OrderLineId
) {
super(id || new UuidIdentity())
}
}
// Aggregate
class Order extends Aggregate<OrderId> {
constructor(
public readonly lines: OrderLine[],
public readonly price: Price,
id?: OrderId
) {
super(id || new UuidIdentity())
}
addLine(line: OrderLine) {
this.lines.push(line)
}
}
// Fetching data
const q = new QueryBuilder<Order>()
// Build queries using builder methods
const tastyDishes = q.or(
q.eq('sku.itemName', 'Lassi'),
q.eq('sku.itemName', 'Dosa'),
)
// Use parametric query
const moreExpensiveThan = (price: number) => q.gte('price', price)
const goldenOrders = moreExpensiveThan(1000)
// Execute query
clientRepository.find(q.and(goldenOrders, commonLastName))