Initial commit

This commit is contained in:
Benjamin Sutter
2026-05-15 00:48:18 +02:00
commit 9e827c50f9
72 changed files with 10477 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import type { FutureSignal } from '../domain/futureSignal'
import type { SignalType } from '../domain/enums'
export interface FutureSignalFilters {
signalType?: SignalType
minProbability?: number
organizationId?: string
isVerified?: boolean
}
export interface IFutureSignalProvider {
getAll(filters?: FutureSignalFilters): Promise<FutureSignal[]>
getById(id: string): Promise<FutureSignal | null>
getByProperty(propertyId: string): Promise<FutureSignal[]>
verify(id: string, verifiedBy: string): Promise<FutureSignal>
}
+18
View File
@@ -0,0 +1,18 @@
import type { Match } from '../domain/match'
import type { MatchStrength } from '../domain/enums'
export interface MatchFilters {
needId?: string
propertyId?: string
minScore?: number
matchStrength?: MatchStrength
organizationId?: string
}
export interface IMatchProvider {
getAll(filters?: MatchFilters): Promise<Match[]>
getById(id: string): Promise<Match | null>
getByNeed(needId: string): Promise<Match[]>
getByProperty(propertyId: string): Promise<Match[]>
approve(id: string, reviewedBy: string): Promise<Match>
}
+16
View File
@@ -0,0 +1,16 @@
import type { Need, CreateNeedInput, UpdateNeedInput } from '../domain/need'
import type { AssetType } from '../domain/enums'
export interface NeedFilters {
assetType?: AssetType
organizationId?: string
companyName?: string
}
export interface INeedProvider {
getAll(filters?: NeedFilters): Promise<Need[]>
getById(id: string): Promise<Need | null>
create(data: CreateNeedInput): Promise<Need>
update(id: string, data: UpdateNeedInput): Promise<Need>
remove(id: string): Promise<void>
}
+19
View File
@@ -0,0 +1,19 @@
import type { Property, CreatePropertyInput, UpdatePropertyInput } from '../domain/property'
import type { AssetType, ResultType } from '../domain/enums'
export interface PropertyFilters {
assetType?: AssetType
resultType?: ResultType
city?: string
minAreaSqm?: number
maxRentPerSqm?: number
organizationId?: string
}
export interface IPropertyProvider {
getAll(filters?: PropertyFilters): Promise<Property[]>
getById(id: string): Promise<Property | null>
create(data: CreatePropertyInput): Promise<Property>
update(id: string, data: UpdatePropertyInput): Promise<Property>
remove(id: string): Promise<void>
}
@@ -0,0 +1,27 @@
import type { IFutureSignalProvider, FutureSignalFilters } from './IFutureSignalProvider'
import type { FutureSignal } from '../domain/futureSignal'
import { mockFutureSignals } from '../mock-data/futureSignals'
const store: FutureSignal[] = [...mockFutureSignals]
export const MockupFutureSignalProvider: IFutureSignalProvider = {
async getAll(filters?: FutureSignalFilters) {
let results = [...store]
if (filters?.signalType) results = results.filter(s => s.signalType === filters.signalType)
if (filters?.minProbability !== undefined) results = results.filter(s => s.probability >= filters.minProbability!)
if (filters?.organizationId) results = results.filter(s => s.organizationId === filters.organizationId)
if (filters?.isVerified !== undefined) results = results.filter(s => s.isVerified === filters.isVerified)
return results.sort((a, b) => b.probability - a.probability)
},
async getById(id) {
return store.find(s => s.id === id) ?? null
},
async getByProperty(propertyId) {
return store.filter(s => s.propertyId === propertyId)
},
async verify(id, verifiedBy) {
const idx = store.findIndex(s => s.id === id)
store[idx] = { ...store[idx], isVerified: true, verifiedBy, verifiedAt: new Date().toISOString(), updatedAt: new Date().toISOString() }
return store[idx]
},
}
+31
View File
@@ -0,0 +1,31 @@
import type { IMatchProvider, MatchFilters } from './IMatchProvider'
import type { Match } from '../domain/match'
import { mockMatches } from '../mock-data/matches'
const store: Match[] = [...mockMatches]
export const MockupMatchProvider: IMatchProvider = {
async getAll(filters?: MatchFilters) {
let results = [...store]
if (filters?.needId) results = results.filter(m => m.needId === filters.needId)
if (filters?.propertyId) results = results.filter(m => m.propertyId === filters.propertyId)
if (filters?.minScore) results = results.filter(m => m.matchScore >= filters.minScore!)
if (filters?.matchStrength) results = results.filter(m => m.matchStrength === filters.matchStrength)
if (filters?.organizationId) results = results.filter(m => m.organizationId === filters.organizationId)
return results.sort((a, b) => b.matchScore - a.matchScore)
},
async getById(id) {
return store.find(m => m.id === id) ?? null
},
async getByNeed(needId) {
return store.filter(m => m.needId === needId).sort((a, b) => b.matchScore - a.matchScore)
},
async getByProperty(propertyId) {
return store.filter(m => m.propertyId === propertyId).sort((a, b) => b.matchScore - a.matchScore)
},
async approve(id, reviewedBy) {
const idx = store.findIndex(m => m.id === id)
store[idx] = { ...store[idx], isApproved: true, reviewedBy, reviewedAt: new Date().toISOString(), updatedAt: new Date().toISOString() }
return store[idx]
},
}
+32
View File
@@ -0,0 +1,32 @@
import type { INeedProvider, NeedFilters } from './INeedProvider'
import type { Need, CreateNeedInput, UpdateNeedInput } from '../domain/need'
import { mockNeeds } from '../mock-data/needs'
const store: Need[] = [...mockNeeds]
export const MockupNeedProvider: INeedProvider = {
async getAll(filters?: NeedFilters) {
let results = [...store]
if (filters?.assetType) results = results.filter(n => n.assetType === filters.assetType)
if (filters?.organizationId) results = results.filter(n => n.organizationId === filters.organizationId)
if (filters?.companyName) results = results.filter(n => n.companyName.toLowerCase().includes(filters.companyName!.toLowerCase()))
return results
},
async getById(id) {
return store.find(n => n.id === id) ?? null
},
async create(data: CreateNeedInput) {
const next: Need = { id: crypto.randomUUID(), ...data, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() }
store.push(next)
return next
},
async update(id, data: UpdateNeedInput) {
const idx = store.findIndex(n => n.id === id)
store[idx] = { ...store[idx], ...data, updatedAt: new Date().toISOString() }
return store[idx]
},
async remove(id) {
const idx = store.findIndex(n => n.id === id)
store.splice(idx, 1)
},
}
+35
View File
@@ -0,0 +1,35 @@
import type { IPropertyProvider, PropertyFilters } from './IPropertyProvider'
import type { Property, CreatePropertyInput, UpdatePropertyInput } from '../domain/property'
import { mockProperties } from '../mock-data/properties'
const store: Property[] = [...mockProperties]
export const MockupPropertyProvider: IPropertyProvider = {
async getAll(filters?: PropertyFilters) {
let results = [...store]
if (filters?.assetType) results = results.filter(p => p.assetType === filters.assetType)
if (filters?.resultType) results = results.filter(p => p.resultType === filters.resultType)
if (filters?.city) results = results.filter(p => p.location.city.toLowerCase().includes(filters.city!.toLowerCase()))
if (filters?.minAreaSqm) results = results.filter(p => p.areaSqm >= filters.minAreaSqm!)
if (filters?.maxRentPerSqm) results = results.filter(p => p.rentPricePerSqm <= filters.maxRentPerSqm!)
if (filters?.organizationId) results = results.filter(p => p.organizationId === filters.organizationId)
return results
},
async getById(id) {
return store.find(p => p.id === id) ?? null
},
async create(data: CreatePropertyInput) {
const next: Property = { id: crypto.randomUUID(), ...data, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() }
store.push(next)
return next
},
async update(id, data: UpdatePropertyInput) {
const idx = store.findIndex(p => p.id === id)
store[idx] = { ...store[idx], ...data, updatedAt: new Date().toISOString() }
return store[idx]
},
async remove(id) {
const idx = store.findIndex(p => p.id === id)
store.splice(idx, 1)
},
}