Skip to content

Data models

packages/shared (@redline/shared) is the single source of truth for the domain. Every schema is a Zod definition: MCP tools use <Schema>.shape as their input schema, the REST API validates with <Schema>.parse(), the persistence layer maps rows to the inferred types, and the static site mirrors them in schema.org JSON-LD. Change a shape here and it propagates everywhere.

Schema files

FileDomain objects & enums
vehicle.tsVehicleType, FuelType, Transmission, Condition, ListingStatus, ModerationStatus, Currency, search/create/update inputs, VehicleListing
seller.tsSellerType, ContactMethod, Language, SellerPlan, profile + location inputs, Seller
organization.tsOrgRole, org core/create/update inputs, Organization, OrganizationMember
account.tsaccount profile, Favorite, SavedSearch, NotificationChannel
review.tsreview input, Review, ReviewList (RATING_MIN=1, RATING_MAX=5)
audit.tsAuditAction, audit log input/entry/query
scopes.tsLISTINGS_READ, LISTINGS_WRITE, LISTINGS_MODERATE, ALL_SCOPES
brand.tsBRAND_NAME (A-Market), BRAND_DOMAIN (amrkt.ch), MCP_RESOURCE_NAME

Key enums

EnumValues
Vehicle typescar, motorcycle, scooter, other
Fuel typespetrol, diesel, electric, hybrid, plugin_hybrid, lpg, cng, hydrogen, other
Transmissionsmanual, automatic, semi_automatic
Conditionsnew, used
Listing statusactive, sold, draft
Moderation statusapproved, pending, rejected
Seller typesprivate, dealer, brand_dealer
Contact methodsphone, email, whatsapp, form
Languagesde, fr, it, en
Org rolesowner, member
Audit actionslisting.create, listing.update, listing.delete, listing.restore, listing.moderate

OAuth scopes

ScopeGrants
listings:readSearch/read listings; manage your own account, favorites, saved searches, reviews
listings:writeCreate/update/delete listings; manage your seller profile, locations, and organizations
listings:moderateModeration queue, soft-delete restore, audit log, review moderation (staff-only)

Identity

A user's identity is the Keycloak subject (sub). It is stored as sellers.id / accounts.id and as dealer_id on a listing. The token must carry a sub, or it is rejected — see the cross-account-leak fix in Architecture.

A-Market — AI-first marketplace for cars, motorcycles and scooters.