feat(sellers): typed domain models for future Seller Management - no logic, no API, no auth changes
Typed models only, per mission. Nothing outside the new files reads
or writes any of this yet.
New core/sellers/models/ (mirrors core/products/models,
core/auth/models convention):
- MarketplaceRef - minimal {id,slug,name} reference from a seller
back to its marketplace, distinct from bootstrap's TenantConfig.
- SellerStatus - 'pending'|'active'|'suspended'|'disabled', no
transition logic.
- SellerScope - {sellerId, marketplaceId}, domain-level counterpart
to BootstrapConfig.seller (SellerConfig from the ADR-011 pass).
- SellerBranding (+SellerContact/SellerAddress/SellerThemeOverrides)
- logo/banner/description/contacts/address/theme overrides, every
field optional. Marketplace branding/theme remain default;
nothing consumes this yet.
- SellerPermissionRole/SellerPermissions - marketplaceOwner/seller/
sellerStaff/platformAdmin. Separate vocabulary from the existing
AdminRole (core/auth/models/permission.model.ts) - not merged, not
wired into any guard, zero auth behavior change.
- Seller - the eventual entity, composed from the above.
Changed (optional-only, verified backward compatible):
- Item (models/item.model.ts) gained sellerId?: string
- AdminProduct (features/admin/products/models/) gained
sellerId?: string
- AdminOrder (features/admin/orders/models/) gained sellerId?: string
Absent means marketplace-owned in every case, exactly like every
existing product/order today. No consumer of any of these three
models needed updating. AdminOrderItem (per-line-item ownership) and
the existing PermissionsConfig/AdminRole system were deliberately not
touched - out of scope for this pass.
Added docs/architecture/foundation/Seller-Management-Domain-Models.md
documenting every new type, every changed field, and the explicit
non-goals list. Linked from the foundation README alongside ADR-011
and the diagrams doc.
tsc --noEmit clean, arch:check (boundaries + cycles) clean.
This commit is contained in:
6
src/app/core/sellers/models/index.ts
Normal file
6
src/app/core/sellers/models/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from './marketplace-ref.model';
|
||||
export * from './seller-branding.model';
|
||||
export * from './seller-permissions.model';
|
||||
export * from './seller-scope.model';
|
||||
export * from './seller-status.model';
|
||||
export * from './seller.model';
|
||||
14
src/app/core/sellers/models/marketplace-ref.model.ts
Normal file
14
src/app/core/sellers/models/marketplace-ref.model.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { UUID } from '../../../shared/types/primitive.types';
|
||||
|
||||
/**
|
||||
* Minimal marketplace reference as seen from a Seller record - not the full
|
||||
* runtime `TenantConfig` (shared/models/config/tenant.model.ts), which stays
|
||||
* the bootstrap-time source of truth for the active marketplace (ADR-001).
|
||||
* This is just enough to say "this seller belongs to that marketplace"
|
||||
* without pulling in the whole tenant contract.
|
||||
*/
|
||||
export interface MarketplaceRef {
|
||||
id: UUID;
|
||||
slug: string;
|
||||
name: string;
|
||||
}
|
||||
34
src/app/core/sellers/models/seller-branding.model.ts
Normal file
34
src/app/core/sellers/models/seller-branding.model.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Future per-seller branding overrides - all optional. Absent fields fall
|
||||
* back to marketplace branding (shared/models/config/branding.model.ts,
|
||||
* BrandingConfig) and marketplace theme (theme.model.ts, ThemeConfig).
|
||||
* Marketplace branding remains the default in every case; nothing here is
|
||||
* consumed anywhere yet.
|
||||
*/
|
||||
export interface SellerContact {
|
||||
email?: string;
|
||||
phone?: string;
|
||||
}
|
||||
|
||||
export interface SellerAddress {
|
||||
line1?: string;
|
||||
line2?: string;
|
||||
city?: string;
|
||||
region?: string;
|
||||
postalCode?: string;
|
||||
country?: string;
|
||||
}
|
||||
|
||||
export interface SellerThemeOverrides {
|
||||
primaryColor?: string;
|
||||
accentColor?: string;
|
||||
}
|
||||
|
||||
export interface SellerBranding {
|
||||
logoUrl?: string;
|
||||
bannerUrl?: string;
|
||||
description?: string;
|
||||
contacts?: SellerContact;
|
||||
address?: SellerAddress;
|
||||
themeOverrides?: SellerThemeOverrides;
|
||||
}
|
||||
16
src/app/core/sellers/models/seller-permissions.model.ts
Normal file
16
src/app/core/sellers/models/seller-permissions.model.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Future permission roles for the Seller Management module - a separate
|
||||
* vocabulary from the existing platform admin roles (core/auth/models/
|
||||
* permission.model.ts, AdminRole: Owner/Manager/Support/ReadOnly). No
|
||||
* authentication or authorization change is introduced by this file; these
|
||||
* types are unused until Seller Management is actually implemented.
|
||||
*/
|
||||
export type SellerPermissionRole =
|
||||
| 'marketplaceOwner'
|
||||
| 'seller'
|
||||
| 'sellerStaff'
|
||||
| 'platformAdmin';
|
||||
|
||||
export interface SellerPermissions {
|
||||
role: SellerPermissionRole;
|
||||
}
|
||||
14
src/app/core/sellers/models/seller-scope.model.ts
Normal file
14
src/app/core/sellers/models/seller-scope.model.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { UUID } from '../../../shared/types/primitive.types';
|
||||
|
||||
/**
|
||||
* Resolved seller-scoped request context - the domain-level counterpart to
|
||||
* `BootstrapConfig.seller` (`SellerConfig`, shared/models/config/seller.model.ts).
|
||||
* That type is the bootstrap wire shape; this one is what seller-aware
|
||||
* domain code (products, orders, permissions) references once it exists.
|
||||
* Backend-resolved only, same as tenant resolution (ADR-001, ADR-011) - no
|
||||
* frontend code constructs this itself.
|
||||
*/
|
||||
export interface SellerScope {
|
||||
sellerId: UUID;
|
||||
marketplaceId: UUID;
|
||||
}
|
||||
6
src/app/core/sellers/models/seller-status.model.ts
Normal file
6
src/app/core/sellers/models/seller-status.model.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Lifecycle status of a seller record. No transition logic exists yet - this
|
||||
* is the typed vocabulary only, for future Seller Management CRUD/moderation
|
||||
* to build against.
|
||||
*/
|
||||
export type SellerStatus = 'pending' | 'active' | 'suspended' | 'disabled';
|
||||
20
src/app/core/sellers/models/seller.model.ts
Normal file
20
src/app/core/sellers/models/seller.model.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { ISODateTime, UUID } from '../../../shared/types/primitive.types';
|
||||
import { MarketplaceRef } from './marketplace-ref.model';
|
||||
import { SellerBranding } from './seller-branding.model';
|
||||
import { SellerStatus } from './seller-status.model';
|
||||
|
||||
/**
|
||||
* A seller record - the future entity Seller Management CRUD will operate
|
||||
* on. No repository, gateway, or facade exists yet; this is the typed shape
|
||||
* only, so future work has a settled model instead of inventing one ad hoc.
|
||||
*/
|
||||
export interface Seller {
|
||||
id: UUID;
|
||||
marketplace: MarketplaceRef;
|
||||
name: string;
|
||||
slug: string;
|
||||
status: SellerStatus;
|
||||
branding?: SellerBranding;
|
||||
createdAt: ISODateTime;
|
||||
updatedAt: ISODateTime;
|
||||
}
|
||||
Reference in New Issue
Block a user