Add local-first SPA architecture and containerized production deploy.
Move data access to use-cases and IndexedDB repositories with optional remote fallback, changelog/sync ports, and encrypted local backup. Add production Docker Compose (nginx frontend + optional backend) and Apache host proxy configuration for deployment. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { appendChange } from '../../infrastructure/sync/changeLogRepository'
|
||||
import { getContactRepository } from '../../infrastructure/repositories/repositoryFactory'
|
||||
|
||||
const contactRepo = () => getContactRepository()
|
||||
|
||||
export async function listContacts(search = '') {
|
||||
return contactRepo().list(search)
|
||||
}
|
||||
|
||||
export async function getContactById(id) {
|
||||
return contactRepo().getById(id)
|
||||
}
|
||||
|
||||
export async function createContact(payload) {
|
||||
const created = await contactRepo().create(payload)
|
||||
await appendChange({
|
||||
entityType: 'contact',
|
||||
entityId: created.id,
|
||||
op: 'created',
|
||||
payloadPatch: created,
|
||||
})
|
||||
return created
|
||||
}
|
||||
|
||||
export async function updateContact(id, payload) {
|
||||
const updated = await contactRepo().update(id, payload)
|
||||
await appendChange({
|
||||
entityType: 'contact',
|
||||
entityId: id,
|
||||
op: 'updated',
|
||||
payloadPatch: payload,
|
||||
})
|
||||
return updated
|
||||
}
|
||||
|
||||
export async function deleteContact(id) {
|
||||
await contactRepo().remove(id)
|
||||
await appendChange({
|
||||
entityType: 'contact',
|
||||
entityId: id,
|
||||
op: 'deleted',
|
||||
payloadPatch: {},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user