REFACTOR: Belonging → Property system migration + utilities update
Property system: - Rename belonging → property throughout (model, controller, routes, service) - Add property sub-models: buildingModel, landModel, belongingModel - Add property lifecycle events: createProperty, deleteProperty - Add propertyStatus component (model, controller, routes, service, seeder) - Add commodity and commodityTransaction model stubs Infrastructure: - Update transactionModel and transactionService - Update events/index.js for new property events - Update seeder (seederDBConnection, seederRunner) - Update typesense client configuration - Update upload utilities (bucket, minio) - Update featureModel and featureSeeder - Update categorySeeder - Update TsApiFeatures utility - Remove docker-compose.yml (moved to root) - Remove legacy belonging component files
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
const catchAsync = require('../../globalErrorHandler/catchAsync')
|
||||
const propertyStatusService = require('./propertyStatusService')
|
||||
|
||||
exports.getAllStatuses = catchAsync(async (req, res, next) => {
|
||||
const statuses = await propertyStatusService.getAllStatuses()
|
||||
|
||||
res.status(200).json({
|
||||
status: 'success',
|
||||
results: statuses.length,
|
||||
data: statuses,
|
||||
})
|
||||
})
|
||||
|
||||
exports.getStatus = catchAsync(async (req, res, next) => {
|
||||
const status = await propertyStatusService.getStatus(req.params.statusId)
|
||||
|
||||
res.status(200).json({
|
||||
status: 'success',
|
||||
data: status,
|
||||
})
|
||||
})
|
||||
|
||||
exports.createStatus = catchAsync(async (req, res, next) => {
|
||||
const status = await propertyStatusService.createStatus(req.body)
|
||||
|
||||
res.status(201).json({
|
||||
status: 'success',
|
||||
data: status,
|
||||
})
|
||||
})
|
||||
|
||||
exports.updateStatus = catchAsync(async (req, res, next) => {
|
||||
const status = await propertyStatusService.updateStatus(req.params.statusId, req.body)
|
||||
|
||||
res.status(200).json({
|
||||
status: 'success',
|
||||
data: status,
|
||||
})
|
||||
})
|
||||
|
||||
exports.deleteStatus = catchAsync(async (req, res, next) => {
|
||||
await propertyStatusService.deleteStatus(req.params.statusId)
|
||||
|
||||
res.status(204).json({
|
||||
status: 'success',
|
||||
data: null,
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user