@octo-cyber/property-management 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/controllers/community.controller.d.ts +3 -0
- package/dist/controllers/community.controller.d.ts.map +1 -0
- package/dist/controllers/community.controller.js +104 -0
- package/dist/controllers/community.controller.js.map +1 -0
- package/dist/controllers/contract.controller.d.ts +3 -0
- package/dist/controllers/contract.controller.d.ts.map +1 -0
- package/dist/controllers/contract.controller.js +35 -0
- package/dist/controllers/contract.controller.js.map +1 -0
- package/dist/controllers/facility.controller.d.ts +3 -0
- package/dist/controllers/facility.controller.d.ts.map +1 -0
- package/dist/controllers/facility.controller.js +60 -0
- package/dist/controllers/facility.controller.js.map +1 -0
- package/dist/controllers/fee.controller.d.ts +3 -0
- package/dist/controllers/fee.controller.d.ts.map +1 -0
- package/dist/controllers/fee.controller.js +98 -0
- package/dist/controllers/fee.controller.js.map +1 -0
- package/dist/controllers/index.d.ts +13 -0
- package/dist/controllers/index.d.ts.map +1 -0
- package/dist/controllers/index.js +34 -0
- package/dist/controllers/index.js.map +1 -0
- package/dist/controllers/meter.controller.d.ts +3 -0
- package/dist/controllers/meter.controller.d.ts.map +1 -0
- package/dist/controllers/meter.controller.js +49 -0
- package/dist/controllers/meter.controller.js.map +1 -0
- package/dist/controllers/owner.controller.d.ts +3 -0
- package/dist/controllers/owner.controller.d.ts.map +1 -0
- package/dist/controllers/owner.controller.js +46 -0
- package/dist/controllers/owner.controller.js.map +1 -0
- package/dist/controllers/patrol.controller.d.ts +3 -0
- package/dist/controllers/patrol.controller.d.ts.map +1 -0
- package/dist/controllers/patrol.controller.js +79 -0
- package/dist/controllers/patrol.controller.js.map +1 -0
- package/dist/controllers/repair-order.controller.d.ts +3 -0
- package/dist/controllers/repair-order.controller.d.ts.map +1 -0
- package/dist/controllers/repair-order.controller.js +85 -0
- package/dist/controllers/repair-order.controller.js.map +1 -0
- package/dist/controllers/statistics.controller.d.ts +3 -0
- package/dist/controllers/statistics.controller.d.ts.map +1 -0
- package/dist/controllers/statistics.controller.js +48 -0
- package/dist/controllers/statistics.controller.js.map +1 -0
- package/dist/entities/bill-detail.entity.d.ts +13 -0
- package/dist/entities/bill-detail.entity.d.ts.map +1 -0
- package/dist/entities/bill-detail.entity.js +70 -0
- package/dist/entities/bill-detail.entity.js.map +1 -0
- package/dist/entities/bill.entity.d.ts +19 -0
- package/dist/entities/bill.entity.d.ts.map +1 -0
- package/dist/entities/bill.entity.js +100 -0
- package/dist/entities/bill.entity.js.map +1 -0
- package/dist/entities/building.entity.d.ts +13 -0
- package/dist/entities/building.entity.d.ts.map +1 -0
- package/dist/entities/building.entity.js +70 -0
- package/dist/entities/building.entity.js.map +1 -0
- package/dist/entities/community.entity.d.ts +17 -0
- package/dist/entities/community.entity.d.ts.map +1 -0
- package/dist/entities/community.entity.js +90 -0
- package/dist/entities/community.entity.js.map +1 -0
- package/dist/entities/contract.entity.d.ts +20 -0
- package/dist/entities/contract.entity.d.ts.map +1 -0
- package/dist/entities/contract.entity.js +105 -0
- package/dist/entities/contract.entity.js.map +1 -0
- package/dist/entities/facility-category.entity.d.ts +9 -0
- package/dist/entities/facility-category.entity.d.ts.map +1 -0
- package/dist/entities/facility-category.entity.js +50 -0
- package/dist/entities/facility-category.entity.js.map +1 -0
- package/dist/entities/facility.entity.d.ts +23 -0
- package/dist/entities/facility.entity.d.ts.map +1 -0
- package/dist/entities/facility.entity.js +120 -0
- package/dist/entities/facility.entity.js.map +1 -0
- package/dist/entities/fee-item.entity.d.ts +16 -0
- package/dist/entities/fee-item.entity.d.ts.map +1 -0
- package/dist/entities/fee-item.entity.js +85 -0
- package/dist/entities/fee-item.entity.js.map +1 -0
- package/dist/entities/fee-standard.entity.d.ts +13 -0
- package/dist/entities/fee-standard.entity.d.ts.map +1 -0
- package/dist/entities/fee-standard.entity.js +70 -0
- package/dist/entities/fee-standard.entity.js.map +1 -0
- package/dist/entities/index.d.ts +55 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +114 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/entities/maintenance-plan.entity.d.ts +15 -0
- package/dist/entities/maintenance-plan.entity.d.ts.map +1 -0
- package/dist/entities/maintenance-plan.entity.js +80 -0
- package/dist/entities/maintenance-plan.entity.js.map +1 -0
- package/dist/entities/maintenance-record.entity.d.ts +14 -0
- package/dist/entities/maintenance-record.entity.d.ts.map +1 -0
- package/dist/entities/maintenance-record.entity.js +75 -0
- package/dist/entities/maintenance-record.entity.js.map +1 -0
- package/dist/entities/meter-reading.entity.d.ts +13 -0
- package/dist/entities/meter-reading.entity.d.ts.map +1 -0
- package/dist/entities/meter-reading.entity.js +70 -0
- package/dist/entities/meter-reading.entity.js.map +1 -0
- package/dist/entities/meter.entity.d.ts +13 -0
- package/dist/entities/meter.entity.d.ts.map +1 -0
- package/dist/entities/meter.entity.js +70 -0
- package/dist/entities/meter.entity.js.map +1 -0
- package/dist/entities/owner-room.entity.d.ts +11 -0
- package/dist/entities/owner-room.entity.d.ts.map +1 -0
- package/dist/entities/owner-room.entity.js +60 -0
- package/dist/entities/owner-room.entity.js.map +1 -0
- package/dist/entities/owner.entity.d.ts +17 -0
- package/dist/entities/owner.entity.d.ts.map +1 -0
- package/dist/entities/owner.entity.js +90 -0
- package/dist/entities/owner.entity.js.map +1 -0
- package/dist/entities/parking-space.entity.d.ts +13 -0
- package/dist/entities/parking-space.entity.d.ts.map +1 -0
- package/dist/entities/parking-space.entity.js +70 -0
- package/dist/entities/parking-space.entity.js.map +1 -0
- package/dist/entities/patrol-issue.entity.d.ts +13 -0
- package/dist/entities/patrol-issue.entity.d.ts.map +1 -0
- package/dist/entities/patrol-issue.entity.js +70 -0
- package/dist/entities/patrol-issue.entity.js.map +1 -0
- package/dist/entities/patrol-plan.entity.d.ts +15 -0
- package/dist/entities/patrol-plan.entity.d.ts.map +1 -0
- package/dist/entities/patrol-plan.entity.js +80 -0
- package/dist/entities/patrol-plan.entity.js.map +1 -0
- package/dist/entities/patrol-point.entity.d.ts +12 -0
- package/dist/entities/patrol-point.entity.d.ts.map +1 -0
- package/dist/entities/patrol-point.entity.js +65 -0
- package/dist/entities/patrol-point.entity.js.map +1 -0
- package/dist/entities/patrol-record.entity.d.ts +16 -0
- package/dist/entities/patrol-record.entity.d.ts.map +1 -0
- package/dist/entities/patrol-record.entity.js +85 -0
- package/dist/entities/patrol-record.entity.js.map +1 -0
- package/dist/entities/patrol-route.entity.d.ts +11 -0
- package/dist/entities/patrol-route.entity.d.ts.map +1 -0
- package/dist/entities/patrol-route.entity.js +60 -0
- package/dist/entities/patrol-route.entity.js.map +1 -0
- package/dist/entities/payment.entity.d.ts +14 -0
- package/dist/entities/payment.entity.d.ts.map +1 -0
- package/dist/entities/payment.entity.js +75 -0
- package/dist/entities/payment.entity.js.map +1 -0
- package/dist/entities/repair-category.entity.d.ts +12 -0
- package/dist/entities/repair-category.entity.d.ts.map +1 -0
- package/dist/entities/repair-category.entity.js +65 -0
- package/dist/entities/repair-category.entity.js.map +1 -0
- package/dist/entities/repair-evaluation.entity.d.ts +12 -0
- package/dist/entities/repair-evaluation.entity.d.ts.map +1 -0
- package/dist/entities/repair-evaluation.entity.js +65 -0
- package/dist/entities/repair-evaluation.entity.js.map +1 -0
- package/dist/entities/repair-order.entity.d.ts +30 -0
- package/dist/entities/repair-order.entity.d.ts.map +1 -0
- package/dist/entities/repair-order.entity.js +155 -0
- package/dist/entities/repair-order.entity.js.map +1 -0
- package/dist/entities/room.entity.d.ts +17 -0
- package/dist/entities/room.entity.d.ts.map +1 -0
- package/dist/entities/room.entity.js +90 -0
- package/dist/entities/room.entity.js.map +1 -0
- package/dist/entities/unit.entity.d.ts +8 -0
- package/dist/entities/unit.entity.d.ts.map +1 -0
- package/dist/entities/unit.entity.js +45 -0
- package/dist/entities/unit.entity.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/dist/property.module.d.ts +8 -0
- package/dist/property.module.d.ts.map +1 -0
- package/dist/property.module.js +43 -0
- package/dist/property.module.js.map +1 -0
- package/dist/schemas/building.schema.d.ts +161 -0
- package/dist/schemas/building.schema.d.ts.map +1 -0
- package/dist/schemas/building.schema.js +43 -0
- package/dist/schemas/building.schema.js.map +1 -0
- package/dist/schemas/community.schema.d.ts +77 -0
- package/dist/schemas/community.schema.d.ts.map +1 -0
- package/dist/schemas/community.schema.js +22 -0
- package/dist/schemas/community.schema.js.map +1 -0
- package/dist/schemas/contract.schema.d.ts +116 -0
- package/dist/schemas/contract.schema.d.ts.map +1 -0
- package/dist/schemas/contract.schema.js +30 -0
- package/dist/schemas/contract.schema.js.map +1 -0
- package/dist/schemas/facility.schema.d.ts +195 -0
- package/dist/schemas/facility.schema.d.ts.map +1 -0
- package/dist/schemas/facility.schema.js +54 -0
- package/dist/schemas/facility.schema.js.map +1 -0
- package/dist/schemas/fee.schema.d.ts +175 -0
- package/dist/schemas/fee.schema.d.ts.map +1 -0
- package/dist/schemas/fee.schema.js +55 -0
- package/dist/schemas/fee.schema.js.map +1 -0
- package/dist/schemas/meter.schema.d.ts +111 -0
- package/dist/schemas/meter.schema.d.ts.map +1 -0
- package/dist/schemas/meter.schema.js +31 -0
- package/dist/schemas/meter.schema.js.map +1 -0
- package/dist/schemas/owner.schema.d.ts +118 -0
- package/dist/schemas/owner.schema.d.ts.map +1 -0
- package/dist/schemas/owner.schema.js +33 -0
- package/dist/schemas/owner.schema.js.map +1 -0
- package/dist/schemas/patrol.schema.d.ts +137 -0
- package/dist/schemas/patrol.schema.d.ts.map +1 -0
- package/dist/schemas/patrol.schema.js +52 -0
- package/dist/schemas/patrol.schema.js.map +1 -0
- package/dist/schemas/repair-order.schema.d.ts +133 -0
- package/dist/schemas/repair-order.schema.d.ts.map +1 -0
- package/dist/schemas/repair-order.schema.js +52 -0
- package/dist/schemas/repair-order.schema.js.map +1 -0
- package/dist/services/bill.service.d.ts +39 -0
- package/dist/services/bill.service.d.ts.map +1 -0
- package/dist/services/bill.service.js +203 -0
- package/dist/services/bill.service.js.map +1 -0
- package/dist/services/building.service.d.ts +22 -0
- package/dist/services/building.service.d.ts.map +1 -0
- package/dist/services/building.service.js +119 -0
- package/dist/services/building.service.js.map +1 -0
- package/dist/services/community.service.d.ts +22 -0
- package/dist/services/community.service.d.ts.map +1 -0
- package/dist/services/community.service.js +87 -0
- package/dist/services/community.service.js.map +1 -0
- package/dist/services/contract.service.d.ts +18 -0
- package/dist/services/contract.service.d.ts.map +1 -0
- package/dist/services/contract.service.js +76 -0
- package/dist/services/contract.service.js.map +1 -0
- package/dist/services/facility.service.d.ts +29 -0
- package/dist/services/facility.service.d.ts.map +1 -0
- package/dist/services/facility.service.js +121 -0
- package/dist/services/facility.service.js.map +1 -0
- package/dist/services/fee.service.d.ts +16 -0
- package/dist/services/fee.service.d.ts.map +1 -0
- package/dist/services/fee.service.js +58 -0
- package/dist/services/fee.service.js.map +1 -0
- package/dist/services/index.d.ts +12 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +26 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/meter.service.d.ts +19 -0
- package/dist/services/meter.service.d.ts.map +1 -0
- package/dist/services/meter.service.js +77 -0
- package/dist/services/meter.service.js.map +1 -0
- package/dist/services/owner.service.d.ts +23 -0
- package/dist/services/owner.service.d.ts.map +1 -0
- package/dist/services/owner.service.js +89 -0
- package/dist/services/owner.service.js.map +1 -0
- package/dist/services/patrol.service.d.ts +32 -0
- package/dist/services/patrol.service.d.ts.map +1 -0
- package/dist/services/patrol.service.js +126 -0
- package/dist/services/patrol.service.js.map +1 -0
- package/dist/services/repair-order.service.d.ts +25 -0
- package/dist/services/repair-order.service.d.ts.map +1 -0
- package/dist/services/repair-order.service.js +143 -0
- package/dist/services/repair-order.service.js.map +1 -0
- package/dist/services/statistics.service.d.ts +16 -0
- package/dist/services/statistics.service.d.ts.map +1 -0
- package/dist/services/statistics.service.js +108 -0
- package/dist/services/statistics.service.js.map +1 -0
- package/package.json +91 -0
- package/web/components/BillStatusBadge.tsx +26 -0
- package/web/components/CommunitySelect.tsx +40 -0
- package/web/components/RepairStatusBadge.tsx +28 -0
- package/web/index.ts +24 -0
- package/web/manifest.ts +66 -0
- package/web/messages/en-US.json +81 -0
- package/web/messages/zh-CN.json +81 -0
- package/web/pages/CommunityPage.tsx +182 -0
- package/web/pages/ContractPage.tsx +111 -0
- package/web/pages/DashboardPage.tsx +136 -0
- package/web/pages/FacilityPage.tsx +109 -0
- package/web/pages/FeeBillPage.tsx +199 -0
- package/web/pages/MeterPage.tsx +104 -0
- package/web/pages/OwnerPage.tsx +135 -0
- package/web/pages/PatrolPage.tsx +91 -0
- package/web/pages/RepairOrderPage.tsx +182 -0
- package/web/services/property-api.service.ts +202 -0
- package/web/stores/property-store.ts +18 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"community.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/community.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAYnE,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAoG1D"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerCommunityRoutes = registerCommunityRoutes;
|
|
4
|
+
const core_1 = require("@octo-cyber/core");
|
|
5
|
+
const community_service_js_1 = require("../services/community.service.js");
|
|
6
|
+
const building_service_js_1 = require("../services/building.service.js");
|
|
7
|
+
const community_schema_js_1 = require("../schemas/community.schema.js");
|
|
8
|
+
const building_schema_js_1 = require("../schemas/building.schema.js");
|
|
9
|
+
function registerCommunityRoutes(app) {
|
|
10
|
+
const commSvc = core_1.Container.get(community_service_js_1.CommunityService);
|
|
11
|
+
const bldSvc = core_1.Container.get(building_service_js_1.BuildingService);
|
|
12
|
+
// ── Communities ───────────────────────────────────────────────────────────
|
|
13
|
+
app.get('/api/v1/property/communities', (0, core_1.asyncHandler)(async (req, res) => {
|
|
14
|
+
const parsed = community_schema_js_1.CommunityQuerySchema.safeParse(req.query);
|
|
15
|
+
if (!parsed.success)
|
|
16
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid query');
|
|
17
|
+
const result = await commSvc.findAll(parsed.data);
|
|
18
|
+
res.json(core_1.ApiResponse.paginated(result.items, result.total, parsed.data.page, parsed.data.pageSize));
|
|
19
|
+
}));
|
|
20
|
+
app.post('/api/v1/property/communities', (0, core_1.asyncHandler)(async (req, res) => {
|
|
21
|
+
const parsed = community_schema_js_1.CreateCommunitySchema.safeParse(req.body);
|
|
22
|
+
if (!parsed.success)
|
|
23
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
24
|
+
const community = await commSvc.create(parsed.data);
|
|
25
|
+
res.status(201).json(core_1.ApiResponse.ok(community, 'Community created'));
|
|
26
|
+
}));
|
|
27
|
+
app.get('/api/v1/property/communities/:id', (0, core_1.asyncHandler)(async (req, res) => {
|
|
28
|
+
const community = await commSvc.findById(req.params.id);
|
|
29
|
+
res.json(core_1.ApiResponse.ok(community));
|
|
30
|
+
}));
|
|
31
|
+
app.put('/api/v1/property/communities/:id', (0, core_1.asyncHandler)(async (req, res) => {
|
|
32
|
+
const parsed = community_schema_js_1.UpdateCommunitySchema.safeParse(req.body);
|
|
33
|
+
if (!parsed.success)
|
|
34
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
35
|
+
const community = await commSvc.update(req.params.id, parsed.data);
|
|
36
|
+
res.json(core_1.ApiResponse.ok(community, 'Community updated'));
|
|
37
|
+
}));
|
|
38
|
+
app.delete('/api/v1/property/communities/:id', (0, core_1.asyncHandler)(async (req, res) => {
|
|
39
|
+
await commSvc.delete(req.params.id);
|
|
40
|
+
res.json(core_1.ApiResponse.ok(null, 'Community deleted'));
|
|
41
|
+
}));
|
|
42
|
+
app.get('/api/v1/property/communities/:id/dashboard', (0, core_1.asyncHandler)(async (req, res) => {
|
|
43
|
+
const data = await commSvc.getDashboard(req.params.id);
|
|
44
|
+
res.json(core_1.ApiResponse.ok(data));
|
|
45
|
+
}));
|
|
46
|
+
app.get('/api/v1/property/communities/:id/tree', (0, core_1.asyncHandler)(async (req, res) => {
|
|
47
|
+
const tree = await bldSvc.getBuildingTree(req.params.id);
|
|
48
|
+
res.json(core_1.ApiResponse.ok(tree));
|
|
49
|
+
}));
|
|
50
|
+
// ── Buildings ─────────────────────────────────────────────────────────────
|
|
51
|
+
app.post('/api/v1/property/buildings', (0, core_1.asyncHandler)(async (req, res) => {
|
|
52
|
+
const parsed = building_schema_js_1.CreateBuildingSchema.safeParse(req.body);
|
|
53
|
+
if (!parsed.success)
|
|
54
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
55
|
+
const building = await bldSvc.createBuilding(parsed.data);
|
|
56
|
+
res.status(201).json(core_1.ApiResponse.ok(building, 'Building created'));
|
|
57
|
+
}));
|
|
58
|
+
app.put('/api/v1/property/buildings/:id', (0, core_1.asyncHandler)(async (req, res) => {
|
|
59
|
+
const parsed = building_schema_js_1.UpdateBuildingSchema.safeParse(req.body);
|
|
60
|
+
if (!parsed.success)
|
|
61
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
62
|
+
const building = await bldSvc.updateBuilding(req.params.id, parsed.data);
|
|
63
|
+
res.json(core_1.ApiResponse.ok(building, 'Building updated'));
|
|
64
|
+
}));
|
|
65
|
+
app.delete('/api/v1/property/buildings/:id', (0, core_1.asyncHandler)(async (req, res) => {
|
|
66
|
+
await bldSvc.deleteBuilding(req.params.id);
|
|
67
|
+
res.json(core_1.ApiResponse.ok(null, 'Building deleted'));
|
|
68
|
+
}));
|
|
69
|
+
// ── Units ─────────────────────────────────────────────────────────────────
|
|
70
|
+
app.post('/api/v1/property/units', (0, core_1.asyncHandler)(async (req, res) => {
|
|
71
|
+
const parsed = building_schema_js_1.CreateUnitSchema.safeParse(req.body);
|
|
72
|
+
if (!parsed.success)
|
|
73
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
74
|
+
const unit = await bldSvc.createUnit(parsed.data);
|
|
75
|
+
res.status(201).json(core_1.ApiResponse.ok(unit, 'Unit created'));
|
|
76
|
+
}));
|
|
77
|
+
// ── Rooms ─────────────────────────────────────────────────────────────────
|
|
78
|
+
app.post('/api/v1/property/rooms', (0, core_1.asyncHandler)(async (req, res) => {
|
|
79
|
+
const parsed = building_schema_js_1.CreateRoomSchema.safeParse(req.body);
|
|
80
|
+
if (!parsed.success)
|
|
81
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
82
|
+
const room = await bldSvc.createRoom(parsed.data);
|
|
83
|
+
res.status(201).json(core_1.ApiResponse.ok(room, 'Room created'));
|
|
84
|
+
}));
|
|
85
|
+
app.post('/api/v1/property/rooms/batch', (0, core_1.asyncHandler)(async (req, res) => {
|
|
86
|
+
const parsed = building_schema_js_1.BatchCreateRoomsSchema.safeParse(req.body);
|
|
87
|
+
if (!parsed.success)
|
|
88
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
89
|
+
const rooms = await bldSvc.batchCreateRooms(parsed.data);
|
|
90
|
+
res.status(201).json(core_1.ApiResponse.ok(rooms, `${rooms.length} rooms created`));
|
|
91
|
+
}));
|
|
92
|
+
app.put('/api/v1/property/rooms/:id', (0, core_1.asyncHandler)(async (req, res) => {
|
|
93
|
+
const parsed = building_schema_js_1.UpdateRoomSchema.safeParse(req.body);
|
|
94
|
+
if (!parsed.success)
|
|
95
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
96
|
+
const room = await bldSvc.updateRoom(req.params.id, parsed.data);
|
|
97
|
+
res.json(core_1.ApiResponse.ok(room, 'Room updated'));
|
|
98
|
+
}));
|
|
99
|
+
app.get('/api/v1/property/rooms/:id', (0, core_1.asyncHandler)(async (req, res) => {
|
|
100
|
+
const room = await bldSvc.getRoomById(req.params.id);
|
|
101
|
+
res.json(core_1.ApiResponse.ok(room));
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=community.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"community.controller.js","sourceRoot":"","sources":["../../src/controllers/community.controller.ts"],"names":[],"mappings":";;AAYA,0DAoGC;AA/GD,2CAAkF;AAClF,2EAAoE;AACpE,yEAAkE;AAClE,wEAEwC;AACxC,sEAGuC;AAEvC,SAAgB,uBAAuB,CAAC,GAAY;IAClD,MAAM,OAAO,GAAG,gBAAS,CAAC,GAAG,CAAC,uCAAgB,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,gBAAS,CAAC,GAAG,CAAC,qCAAe,CAAC,CAAC;IAE9C,6EAA6E;IAC7E,GAAG,CAAC,GAAG,CAAC,8BAA8B,EAAE,IAAA,mBAAY,EAAC,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;QACzF,MAAM,MAAM,GAAG,0CAAoB,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,MAAM,eAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,eAAe,CAAC,CAAC;QACnG,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClD,GAAG,CAAC,IAAI,CAAC,kBAAW,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAA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QACnG,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAY,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3E,GAAG,CAAC,IAAI,CAAC,kBAAW,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC,CAAC;IAEJ,GAAG,CAAC,GAAG,CAAC,4BAA4B,EAAE,IAAA,mBAAY,EAAC,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;QACvF,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,EAAY,CAAC,CAAC;QAC/D,GAAG,CAAC,IAAI,CAAC,kBAAW,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/contract.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAKnE,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CA4BzD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerContractRoutes = registerContractRoutes;
|
|
4
|
+
const core_1 = require("@octo-cyber/core");
|
|
5
|
+
const contract_service_js_1 = require("../services/contract.service.js");
|
|
6
|
+
const contract_schema_js_1 = require("../schemas/contract.schema.js");
|
|
7
|
+
function registerContractRoutes(app) {
|
|
8
|
+
const svc = core_1.Container.get(contract_service_js_1.ContractService);
|
|
9
|
+
app.get('/api/v1/property/contracts', (0, core_1.asyncHandler)(async (req, res) => {
|
|
10
|
+
const parsed = contract_schema_js_1.ContractQuerySchema.safeParse(req.query);
|
|
11
|
+
if (!parsed.success)
|
|
12
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid query');
|
|
13
|
+
const result = await svc.findAll(parsed.data);
|
|
14
|
+
res.json(core_1.ApiResponse.paginated(result.items, result.total, parsed.data.page, parsed.data.pageSize));
|
|
15
|
+
}));
|
|
16
|
+
app.post('/api/v1/property/contracts', (0, core_1.asyncHandler)(async (req, res) => {
|
|
17
|
+
const parsed = contract_schema_js_1.CreateContractSchema.safeParse(req.body);
|
|
18
|
+
if (!parsed.success)
|
|
19
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
20
|
+
const contract = await svc.create(parsed.data);
|
|
21
|
+
res.status(201).json(core_1.ApiResponse.ok(contract, 'Contract created'));
|
|
22
|
+
}));
|
|
23
|
+
app.get('/api/v1/property/contracts/:id', (0, core_1.asyncHandler)(async (req, res) => {
|
|
24
|
+
const contract = await svc.findById(req.params.id);
|
|
25
|
+
res.json(core_1.ApiResponse.ok(contract));
|
|
26
|
+
}));
|
|
27
|
+
app.put('/api/v1/property/contracts/:id', (0, core_1.asyncHandler)(async (req, res) => {
|
|
28
|
+
const parsed = contract_schema_js_1.UpdateContractSchema.safeParse(req.body);
|
|
29
|
+
if (!parsed.success)
|
|
30
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
31
|
+
const contract = await svc.update(req.params.id, parsed.data);
|
|
32
|
+
res.json(core_1.ApiResponse.ok(contract, 'Contract updated'));
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=contract.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.controller.js","sourceRoot":"","sources":["../../src/controllers/contract.controller.ts"],"names":[],"mappings":";;AAKA,wDA4BC;AAhCD,2CAAkF;AAClF,yEAAkE;AAClE,sEAAgH;AAEhH,SAAgB,sBAAsB,CAAC,GAAY;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DzD"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerFacilityRoutes = registerFacilityRoutes;
|
|
4
|
+
const core_1 = require("@octo-cyber/core");
|
|
5
|
+
const facility_service_js_1 = require("../services/facility.service.js");
|
|
6
|
+
const facility_schema_js_1 = require("../schemas/facility.schema.js");
|
|
7
|
+
function registerFacilityRoutes(app) {
|
|
8
|
+
const svc = core_1.Container.get(facility_service_js_1.FacilityService);
|
|
9
|
+
app.get('/api/v1/property/facility-categories', (0, core_1.asyncHandler)(async (_req, res) => {
|
|
10
|
+
const categories = await svc.listCategories();
|
|
11
|
+
res.json(core_1.ApiResponse.ok(categories));
|
|
12
|
+
}));
|
|
13
|
+
app.get('/api/v1/property/facilities', (0, core_1.asyncHandler)(async (req, res) => {
|
|
14
|
+
const parsed = facility_schema_js_1.FacilityQuerySchema.safeParse(req.query);
|
|
15
|
+
if (!parsed.success)
|
|
16
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid query');
|
|
17
|
+
const result = await svc.findAll(parsed.data);
|
|
18
|
+
res.json(core_1.ApiResponse.paginated(result.items, result.total, parsed.data.page, parsed.data.pageSize));
|
|
19
|
+
}));
|
|
20
|
+
app.post('/api/v1/property/facilities', (0, core_1.asyncHandler)(async (req, res) => {
|
|
21
|
+
const parsed = facility_schema_js_1.CreateFacilitySchema.safeParse(req.body);
|
|
22
|
+
if (!parsed.success)
|
|
23
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
24
|
+
const facility = await svc.create(parsed.data);
|
|
25
|
+
res.status(201).json(core_1.ApiResponse.ok(facility, 'Facility created'));
|
|
26
|
+
}));
|
|
27
|
+
app.get('/api/v1/property/facilities/:id', (0, core_1.asyncHandler)(async (req, res) => {
|
|
28
|
+
const facility = await svc.findById(req.params.id);
|
|
29
|
+
res.json(core_1.ApiResponse.ok(facility));
|
|
30
|
+
}));
|
|
31
|
+
app.put('/api/v1/property/facilities/:id', (0, core_1.asyncHandler)(async (req, res) => {
|
|
32
|
+
const parsed = facility_schema_js_1.UpdateFacilitySchema.safeParse(req.body);
|
|
33
|
+
if (!parsed.success)
|
|
34
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
35
|
+
const facility = await svc.update(req.params.id, parsed.data);
|
|
36
|
+
res.json(core_1.ApiResponse.ok(facility, 'Facility updated'));
|
|
37
|
+
}));
|
|
38
|
+
app.post('/api/v1/property/facilities/:id/maintenance-plans', (0, core_1.asyncHandler)(async (req, res) => {
|
|
39
|
+
const parsed = facility_schema_js_1.CreateMaintenancePlanSchema.safeParse({ ...req.body, facilityId: req.params.id });
|
|
40
|
+
if (!parsed.success)
|
|
41
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
42
|
+
const plan = await svc.createMaintenancePlan(parsed.data);
|
|
43
|
+
res.status(201).json(core_1.ApiResponse.ok(plan, 'Maintenance plan created'));
|
|
44
|
+
}));
|
|
45
|
+
app.post('/api/v1/property/facilities/:id/maintenance-records', (0, core_1.asyncHandler)(async (req, res) => {
|
|
46
|
+
const parsed = facility_schema_js_1.CreateMaintenanceRecordSchema.safeParse({ ...req.body, facilityId: req.params.id });
|
|
47
|
+
if (!parsed.success)
|
|
48
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
49
|
+
const record = await svc.recordMaintenance(parsed.data);
|
|
50
|
+
res.status(201).json(core_1.ApiResponse.ok(record, 'Maintenance record created'));
|
|
51
|
+
}));
|
|
52
|
+
app.get('/api/v1/property/maintenance/overdue', (0, core_1.asyncHandler)(async (req, res) => {
|
|
53
|
+
const communityId = req.query.communityId;
|
|
54
|
+
if (!communityId)
|
|
55
|
+
throw core_1.AppError.badRequest('communityId required');
|
|
56
|
+
const plans = await svc.getOverdueMaintenances(communityId);
|
|
57
|
+
res.json(core_1.ApiResponse.ok(plans));
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=facility.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"facility.controller.js","sourceRoot":"","sources":["../../src/controllers/facility.controller.ts"],"names":[],"mappings":";;AAQA,wDAsDC;AA7DD,2CAAkF;AAClF,yEAAkE;AAClE,sEAGuC;AAEvC,SAAgB,sBAAsB,CAAC,GAAY;IACjD,MAAM,GAAG,GAAG,gBAAS,CAAC,GAAG,CAAC,qCAAe,CAAC,CAAC;IAE3C,GAAG,CAAC,GAAG,CAAC,sCAAsC,EAAE,IAAA,mBAAY,EAAC,KAAK,EAAE,IAAa,EAAE,GAAa,EAAE,EAAE;QAClG,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,cAAc,EAAE,CAAC;QAC9C,GAAG,CAAC,IAAI,CAAC,kBAAW,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC,CAAC;IAEJ,GAAG,CAAC,GAAG,CAAC,6BAA6B,EAAE,IAAA,mBAAY,EAAC,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;QACxF,MAAM,MAAM,GAAG,wCAAmB,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,MAAM,eAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,eAAe,CAAC,CAAC;QACnG,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9C,GAAG,CAAC,IAAI,CAAC,kBAAW,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,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AAC,CAAC;QACnG,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,MAAM,eAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,eAAe,CAAC,CAAC;QACnG,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACxD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,kBAAW,CAAC,EAAE,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC,CAAC;IAEJ,GAAG,CAAC,GAAG,CAAC,sCAAsC,EAAE,IAAA,mBAAY,EAAC,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;QACjG,MAAM,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,WAAqB,CAAC;QACpD,IAAI,CAAC,WAAW;YAAE,MAAM,eAAQ,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;QACpE,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;QAC5D,GAAG,CAAC,IAAI,CAAC,kBAAW,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fee.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/fee.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAgBnE,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAuFpD"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerFeeRoutes = registerFeeRoutes;
|
|
4
|
+
const core_1 = require("@octo-cyber/core");
|
|
5
|
+
const fee_service_js_1 = require("../services/fee.service.js");
|
|
6
|
+
const bill_service_js_1 = require("../services/bill.service.js");
|
|
7
|
+
const fee_schema_js_1 = require("../schemas/fee.schema.js");
|
|
8
|
+
const zod_1 = require("zod");
|
|
9
|
+
const PaymentQuerySchema = zod_1.z.object({
|
|
10
|
+
page: zod_1.z.coerce.number().int().min(1).default(1),
|
|
11
|
+
pageSize: zod_1.z.coerce.number().int().min(1).max(100).default(20),
|
|
12
|
+
billId: zod_1.z.string().uuid().optional(),
|
|
13
|
+
});
|
|
14
|
+
function registerFeeRoutes(app) {
|
|
15
|
+
const feeSvc = core_1.Container.get(fee_service_js_1.FeeService);
|
|
16
|
+
const billSvc = core_1.Container.get(bill_service_js_1.BillService);
|
|
17
|
+
app.get('/api/v1/property/fee-items', (0, core_1.asyncHandler)(async (req, res) => {
|
|
18
|
+
const communityId = req.query.communityId;
|
|
19
|
+
const items = await feeSvc.listFeeItems(communityId);
|
|
20
|
+
res.json(core_1.ApiResponse.ok(items));
|
|
21
|
+
}));
|
|
22
|
+
app.post('/api/v1/property/fee-items', (0, core_1.asyncHandler)(async (req, res) => {
|
|
23
|
+
const parsed = fee_schema_js_1.CreateFeeItemSchema.safeParse(req.body);
|
|
24
|
+
if (!parsed.success)
|
|
25
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
26
|
+
const item = await feeSvc.createFeeItem(parsed.data);
|
|
27
|
+
res.status(201).json(core_1.ApiResponse.ok(item, 'Fee item created'));
|
|
28
|
+
}));
|
|
29
|
+
app.put('/api/v1/property/fee-items/:id', (0, core_1.asyncHandler)(async (req, res) => {
|
|
30
|
+
const parsed = fee_schema_js_1.UpdateFeeItemSchema.safeParse(req.body);
|
|
31
|
+
if (!parsed.success)
|
|
32
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
33
|
+
const item = await feeSvc.updateFeeItem(req.params.id, parsed.data);
|
|
34
|
+
res.json(core_1.ApiResponse.ok(item, 'Fee item updated'));
|
|
35
|
+
}));
|
|
36
|
+
app.get('/api/v1/property/fee-standards', (0, core_1.asyncHandler)(async (req, res) => {
|
|
37
|
+
const feeItemId = req.query.feeItemId;
|
|
38
|
+
const standards = await feeSvc.listFeeStandards(feeItemId);
|
|
39
|
+
res.json(core_1.ApiResponse.ok(standards));
|
|
40
|
+
}));
|
|
41
|
+
app.post('/api/v1/property/fee-standards', (0, core_1.asyncHandler)(async (req, res) => {
|
|
42
|
+
const parsed = fee_schema_js_1.CreateFeeStandardSchema.safeParse(req.body);
|
|
43
|
+
if (!parsed.success)
|
|
44
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
45
|
+
const standard = await feeSvc.createFeeStandard(parsed.data);
|
|
46
|
+
res.status(201).json(core_1.ApiResponse.ok(standard, 'Fee standard created'));
|
|
47
|
+
}));
|
|
48
|
+
app.post('/api/v1/property/bills/generate', (0, core_1.asyncHandler)(async (req, res) => {
|
|
49
|
+
const parsed = fee_schema_js_1.GenerateBillsSchema.safeParse(req.body);
|
|
50
|
+
if (!parsed.success)
|
|
51
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
52
|
+
const result = await billSvc.generateBills(parsed.data);
|
|
53
|
+
res.status(201).json(core_1.ApiResponse.ok(result, `${result.created} bills generated, ${result.skipped} skipped`));
|
|
54
|
+
}));
|
|
55
|
+
app.get('/api/v1/property/bills', (0, core_1.asyncHandler)(async (req, res) => {
|
|
56
|
+
const parsed = fee_schema_js_1.BillQuerySchema.safeParse(req.query);
|
|
57
|
+
if (!parsed.success)
|
|
58
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid query');
|
|
59
|
+
const result = await billSvc.findAll(parsed.data);
|
|
60
|
+
res.json(core_1.ApiResponse.paginated(result.items, result.total, parsed.data.page, parsed.data.pageSize));
|
|
61
|
+
}));
|
|
62
|
+
app.get('/api/v1/property/bills/:id', (0, core_1.asyncHandler)(async (req, res) => {
|
|
63
|
+
const bill = await billSvc.findById(req.params.id);
|
|
64
|
+
res.json(core_1.ApiResponse.ok(bill));
|
|
65
|
+
}));
|
|
66
|
+
app.post('/api/v1/property/bills/:id/payment', (0, core_1.asyncHandler)(async (req, res) => {
|
|
67
|
+
const parsed = fee_schema_js_1.CreatePaymentSchema.safeParse(req.body);
|
|
68
|
+
if (!parsed.success)
|
|
69
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
70
|
+
const payment = await billSvc.recordPayment(req.params.id, parsed.data);
|
|
71
|
+
res.status(201).json(core_1.ApiResponse.ok(payment, 'Payment recorded'));
|
|
72
|
+
}));
|
|
73
|
+
app.post('/api/v1/property/bills/:id/discount', (0, core_1.asyncHandler)(async (req, res) => {
|
|
74
|
+
const parsed = fee_schema_js_1.DiscountBillSchema.safeParse(req.body);
|
|
75
|
+
if (!parsed.success)
|
|
76
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
77
|
+
const bill = await billSvc.applyDiscount(req.params.id, parsed.data);
|
|
78
|
+
res.json(core_1.ApiResponse.ok(bill, 'Discount applied'));
|
|
79
|
+
}));
|
|
80
|
+
app.get('/api/v1/property/payments', (0, core_1.asyncHandler)(async (req, res) => {
|
|
81
|
+
const parsed = PaymentQuerySchema.safeParse(req.query);
|
|
82
|
+
if (!parsed.success)
|
|
83
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid query');
|
|
84
|
+
const result = await billSvc.findPayments(parsed.data);
|
|
85
|
+
res.json(core_1.ApiResponse.paginated(result.items, result.total, parsed.data.page, parsed.data.pageSize));
|
|
86
|
+
}));
|
|
87
|
+
app.get('/api/v1/property/overdue', (0, core_1.asyncHandler)(async (req, res) => {
|
|
88
|
+
const communityId = req.query.communityId;
|
|
89
|
+
if (!communityId)
|
|
90
|
+
throw core_1.AppError.badRequest('communityId required');
|
|
91
|
+
const bills = await billSvc.findOverdue(communityId);
|
|
92
|
+
res.json(core_1.ApiResponse.ok(bills));
|
|
93
|
+
}));
|
|
94
|
+
app.post('/api/v1/property/overdue/notify', (0, core_1.asyncHandler)(async (_req, res) => {
|
|
95
|
+
res.json(core_1.ApiResponse.ok({ message: 'Notify sent (integrate with @octo-cyber/notification)' }));
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=fee.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fee.controller.js","sourceRoot":"","sources":["../../src/controllers/fee.controller.ts"],"names":[],"mappings":";;AAgBA,8CAuFC;AAtGD,2CAAkF;AAClF,+DAAwD;AACxD,iEAA0D;AAC1D,4DAGkC;AAClC,6BAAwB;AAExB,MAAM,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,IAAI,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/C,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAC7D,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC;AAEH,SAAgB,iBAAiB,CAAC,GAAY;IAC5C,MAAM,MAAM,GAAG,gBAAS,CAAC,GAAG,CAAC,2BAAU,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,gBAAS,CAAC,GAAG,CAAC,6BAAW,CAAC,CAAC;IAE3C,GAAG,CAAC,GAAG,CAAC,4BAA4B,EAAE,IAAA,mBAAY,EAAC,KAAK,EAAE,GAAY,EAAE,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C;QACrD,GAAG,CAAC,IAAI,CAAC,kBAAW,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC,CAAC;IAEJ,GAAG,CAAC,IAAI,CAAC,iCAAiC,EAAE,IAAA,mBAAY,EAAC,KAAK,EAAE,IAAa,EAAE,GAAa,EAAE,EAAE;QAC9F,GAAG,CAAC,IAAI,CAAC,kBAAW,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,uDAAuD,EAAE,CAAC,CAAC,CAAC;IACjG,CAAC,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Express } from '@octo-cyber/core';
|
|
2
|
+
import { registerCommunityRoutes } from './community.controller.js';
|
|
3
|
+
import { registerOwnerRoutes } from './owner.controller.js';
|
|
4
|
+
import { registerRepairRoutes } from './repair-order.controller.js';
|
|
5
|
+
import { registerFeeRoutes } from './fee.controller.js';
|
|
6
|
+
import { registerPatrolRoutes } from './patrol.controller.js';
|
|
7
|
+
import { registerFacilityRoutes } from './facility.controller.js';
|
|
8
|
+
import { registerContractRoutes } from './contract.controller.js';
|
|
9
|
+
import { registerMeterRoutes } from './meter.controller.js';
|
|
10
|
+
import { registerStatisticsRoutes } from './statistics.controller.js';
|
|
11
|
+
export declare function registerPropertyRoutes(app: Express): void;
|
|
12
|
+
export { registerCommunityRoutes, registerOwnerRoutes, registerRepairRoutes, registerFeeRoutes, registerPatrolRoutes, registerFacilityRoutes, registerContractRoutes, registerMeterRoutes, registerStatisticsRoutes, };
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/controllers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAUzD;AAED,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,GACzB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerStatisticsRoutes = exports.registerMeterRoutes = exports.registerContractRoutes = exports.registerFacilityRoutes = exports.registerPatrolRoutes = exports.registerFeeRoutes = exports.registerRepairRoutes = exports.registerOwnerRoutes = exports.registerCommunityRoutes = void 0;
|
|
4
|
+
exports.registerPropertyRoutes = registerPropertyRoutes;
|
|
5
|
+
const community_controller_js_1 = require("./community.controller.js");
|
|
6
|
+
Object.defineProperty(exports, "registerCommunityRoutes", { enumerable: true, get: function () { return community_controller_js_1.registerCommunityRoutes; } });
|
|
7
|
+
const owner_controller_js_1 = require("./owner.controller.js");
|
|
8
|
+
Object.defineProperty(exports, "registerOwnerRoutes", { enumerable: true, get: function () { return owner_controller_js_1.registerOwnerRoutes; } });
|
|
9
|
+
const repair_order_controller_js_1 = require("./repair-order.controller.js");
|
|
10
|
+
Object.defineProperty(exports, "registerRepairRoutes", { enumerable: true, get: function () { return repair_order_controller_js_1.registerRepairRoutes; } });
|
|
11
|
+
const fee_controller_js_1 = require("./fee.controller.js");
|
|
12
|
+
Object.defineProperty(exports, "registerFeeRoutes", { enumerable: true, get: function () { return fee_controller_js_1.registerFeeRoutes; } });
|
|
13
|
+
const patrol_controller_js_1 = require("./patrol.controller.js");
|
|
14
|
+
Object.defineProperty(exports, "registerPatrolRoutes", { enumerable: true, get: function () { return patrol_controller_js_1.registerPatrolRoutes; } });
|
|
15
|
+
const facility_controller_js_1 = require("./facility.controller.js");
|
|
16
|
+
Object.defineProperty(exports, "registerFacilityRoutes", { enumerable: true, get: function () { return facility_controller_js_1.registerFacilityRoutes; } });
|
|
17
|
+
const contract_controller_js_1 = require("./contract.controller.js");
|
|
18
|
+
Object.defineProperty(exports, "registerContractRoutes", { enumerable: true, get: function () { return contract_controller_js_1.registerContractRoutes; } });
|
|
19
|
+
const meter_controller_js_1 = require("./meter.controller.js");
|
|
20
|
+
Object.defineProperty(exports, "registerMeterRoutes", { enumerable: true, get: function () { return meter_controller_js_1.registerMeterRoutes; } });
|
|
21
|
+
const statistics_controller_js_1 = require("./statistics.controller.js");
|
|
22
|
+
Object.defineProperty(exports, "registerStatisticsRoutes", { enumerable: true, get: function () { return statistics_controller_js_1.registerStatisticsRoutes; } });
|
|
23
|
+
function registerPropertyRoutes(app) {
|
|
24
|
+
(0, community_controller_js_1.registerCommunityRoutes)(app);
|
|
25
|
+
(0, owner_controller_js_1.registerOwnerRoutes)(app);
|
|
26
|
+
(0, repair_order_controller_js_1.registerRepairRoutes)(app);
|
|
27
|
+
(0, fee_controller_js_1.registerFeeRoutes)(app);
|
|
28
|
+
(0, patrol_controller_js_1.registerPatrolRoutes)(app);
|
|
29
|
+
(0, facility_controller_js_1.registerFacilityRoutes)(app);
|
|
30
|
+
(0, contract_controller_js_1.registerContractRoutes)(app);
|
|
31
|
+
(0, meter_controller_js_1.registerMeterRoutes)(app);
|
|
32
|
+
(0, statistics_controller_js_1.registerStatisticsRoutes)(app);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/controllers/index.ts"],"names":[],"mappings":";;;AAWA,wDAUC;AApBD,uEAAoE;AAuBlE,wGAvBO,iDAAuB,OAuBP;AAtBzB,+DAA4D;AAuB1D,oGAvBO,yCAAmB,OAuBP;AAtBrB,6EAAoE;AAuBlE,qGAvBO,iDAAoB,OAuBP;AAtBtB,2DAAwD;AAuBtD,kGAvBO,qCAAiB,OAuBP;AAtBnB,iEAA8D;AAuB5D,qGAvBO,2CAAoB,OAuBP;AAtBtB,qEAAkE;AAuBhE,uGAvBO,+CAAsB,OAuBP;AAtBxB,qEAAkE;AAuBhE,uGAvBO,+CAAsB,OAuBP;AAtBxB,+DAA4D;AAuB1D,oGAvBO,yCAAmB,OAuBP;AAtBrB,yEAAsE;AAuBpE,yGAvBO,mDAAwB,OAuBP;AArB1B,SAAgB,sBAAsB,CAAC,GAAY;IACjD,IAAA,iDAAuB,EAAC,GAAG,CAAC,CAAC;IAC7B,IAAA,yCAAmB,EAAC,GAAG,CAAC,CAAC;IACzB,IAAA,iDAAoB,EAAC,GAAG,CAAC,CAAC;IAC1B,IAAA,qCAAiB,EAAC,GAAG,CAAC,CAAC;IACvB,IAAA,2CAAoB,EAAC,GAAG,CAAC,CAAC;IAC1B,IAAA,+CAAsB,EAAC,GAAG,CAAC,CAAC;IAC5B,IAAA,+CAAsB,EAAC,GAAG,CAAC,CAAC;IAC5B,IAAA,yCAAmB,EAAC,GAAG,CAAC,CAAC;IACzB,IAAA,mDAAwB,EAAC,GAAG,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meter.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/meter.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAYnE,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAqCtD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerMeterRoutes = registerMeterRoutes;
|
|
4
|
+
const core_1 = require("@octo-cyber/core");
|
|
5
|
+
const meter_service_js_1 = require("../services/meter.service.js");
|
|
6
|
+
const meter_schema_js_1 = require("../schemas/meter.schema.js");
|
|
7
|
+
const zod_1 = require("zod");
|
|
8
|
+
const UsageHistoryQuerySchema = zod_1.z.object({
|
|
9
|
+
months: zod_1.z.coerce.number().int().min(1).max(24).default(6),
|
|
10
|
+
});
|
|
11
|
+
function registerMeterRoutes(app) {
|
|
12
|
+
const svc = core_1.Container.get(meter_service_js_1.MeterService);
|
|
13
|
+
app.get('/api/v1/property/meters', (0, core_1.asyncHandler)(async (req, res) => {
|
|
14
|
+
const parsed = meter_schema_js_1.MeterQuerySchema.safeParse(req.query);
|
|
15
|
+
if (!parsed.success)
|
|
16
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid query');
|
|
17
|
+
const result = await svc.findAll(parsed.data);
|
|
18
|
+
res.json(core_1.ApiResponse.paginated(result.items, result.total, parsed.data.page, parsed.data.pageSize));
|
|
19
|
+
}));
|
|
20
|
+
app.post('/api/v1/property/meters', (0, core_1.asyncHandler)(async (req, res) => {
|
|
21
|
+
const parsed = meter_schema_js_1.CreateMeterSchema.safeParse(req.body);
|
|
22
|
+
if (!parsed.success)
|
|
23
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
24
|
+
const meter = await svc.create(parsed.data);
|
|
25
|
+
res.status(201).json(core_1.ApiResponse.ok(meter, 'Meter created'));
|
|
26
|
+
}));
|
|
27
|
+
app.post('/api/v1/property/meter-readings', (0, core_1.asyncHandler)(async (req, res) => {
|
|
28
|
+
const parsed = meter_schema_js_1.CreateMeterReadingSchema.safeParse(req.body);
|
|
29
|
+
if (!parsed.success)
|
|
30
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
31
|
+
const reading = await svc.recordReading(parsed.data);
|
|
32
|
+
res.status(201).json(core_1.ApiResponse.ok(reading, 'Reading recorded'));
|
|
33
|
+
}));
|
|
34
|
+
app.post('/api/v1/property/meter-readings/batch', (0, core_1.asyncHandler)(async (req, res) => {
|
|
35
|
+
const parsed = meter_schema_js_1.BatchMeterReadingSchema.safeParse(req.body);
|
|
36
|
+
if (!parsed.success)
|
|
37
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
38
|
+
const readings = await svc.batchRecordReadings(parsed.data.readings);
|
|
39
|
+
res.status(201).json(core_1.ApiResponse.ok(readings, `${readings.length} readings recorded`));
|
|
40
|
+
}));
|
|
41
|
+
app.get('/api/v1/property/meter-readings/:meterId/history', (0, core_1.asyncHandler)(async (req, res) => {
|
|
42
|
+
const parsed = UsageHistoryQuerySchema.safeParse(req.query);
|
|
43
|
+
if (!parsed.success)
|
|
44
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid query');
|
|
45
|
+
const history = await svc.getUsageHistory(req.params.meterId, parsed.data.months);
|
|
46
|
+
res.json(core_1.ApiResponse.ok(history));
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=meter.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meter.controller.js","sourceRoot":"","sources":["../../src/controllers/meter.controller.ts"],"names":[],"mappings":";;AAYA,kDAqCC;AAhDD,2CAAkF;AAClF,mEAA4D;AAC5D,gEAEoC;AACpC,6BAAwB;AAExB,MAAM,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,MAAM,EAAE,OAAC,CAAC,MAA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mB,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,kBAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,QAAQ,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC;IACzF,CAAC,CAAC,CAAC,CAAC;IAEJ,GAAG,CAAC,GAAG,CAAC,kDAAkD,EAAE,IAAA,mBAAY,EAAC,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;QAC7G,MAAM,MAAM,GAAG,uBAAuB,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC5D,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,MAAM,eAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,eAAe,CAAC,CAAC;QACnG,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,OAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5F,GAAG,CAAC,IAAI,CAAC,kBAAW,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owner.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/owner.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAOnE,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAwCtD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerOwnerRoutes = registerOwnerRoutes;
|
|
4
|
+
const core_1 = require("@octo-cyber/core");
|
|
5
|
+
const owner_service_js_1 = require("../services/owner.service.js");
|
|
6
|
+
const owner_schema_js_1 = require("../schemas/owner.schema.js");
|
|
7
|
+
function registerOwnerRoutes(app) {
|
|
8
|
+
const svc = core_1.Container.get(owner_service_js_1.OwnerService);
|
|
9
|
+
app.get('/api/v1/property/owners', (0, core_1.asyncHandler)(async (req, res) => {
|
|
10
|
+
const parsed = owner_schema_js_1.OwnerQuerySchema.safeParse(req.query);
|
|
11
|
+
if (!parsed.success)
|
|
12
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid query');
|
|
13
|
+
const result = await svc.findAll(parsed.data);
|
|
14
|
+
res.json(core_1.ApiResponse.paginated(result.items, result.total, parsed.data.page, parsed.data.pageSize));
|
|
15
|
+
}));
|
|
16
|
+
app.post('/api/v1/property/owners', (0, core_1.asyncHandler)(async (req, res) => {
|
|
17
|
+
const parsed = owner_schema_js_1.CreateOwnerSchema.safeParse(req.body);
|
|
18
|
+
if (!parsed.success)
|
|
19
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
20
|
+
const owner = await svc.create(parsed.data);
|
|
21
|
+
res.status(201).json(core_1.ApiResponse.ok(owner, 'Owner created'));
|
|
22
|
+
}));
|
|
23
|
+
app.get('/api/v1/property/owners/:id', (0, core_1.asyncHandler)(async (req, res) => {
|
|
24
|
+
const owner = await svc.findById(req.params.id);
|
|
25
|
+
res.json(core_1.ApiResponse.ok(owner));
|
|
26
|
+
}));
|
|
27
|
+
app.put('/api/v1/property/owners/:id', (0, core_1.asyncHandler)(async (req, res) => {
|
|
28
|
+
const parsed = owner_schema_js_1.UpdateOwnerSchema.safeParse(req.body);
|
|
29
|
+
if (!parsed.success)
|
|
30
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
31
|
+
const owner = await svc.update(req.params.id, parsed.data);
|
|
32
|
+
res.json(core_1.ApiResponse.ok(owner, 'Owner updated'));
|
|
33
|
+
}));
|
|
34
|
+
app.post('/api/v1/property/owners/:id/rooms', (0, core_1.asyncHandler)(async (req, res) => {
|
|
35
|
+
const parsed = owner_schema_js_1.BindRoomSchema.safeParse(req.body);
|
|
36
|
+
if (!parsed.success)
|
|
37
|
+
throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
|
|
38
|
+
const ownerRoom = await svc.bindRoom(req.params.id, parsed.data);
|
|
39
|
+
res.status(201).json(core_1.ApiResponse.ok(ownerRoom, 'Room bound'));
|
|
40
|
+
}));
|
|
41
|
+
app.delete('/api/v1/property/owners/:id/rooms/:roomId', (0, core_1.asyncHandler)(async (req, res) => {
|
|
42
|
+
await svc.unbindRoom(req.params.id, req.params.roomId);
|
|
43
|
+
res.json(core_1.ApiResponse.ok(null, 'Room unbound'));
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=owner.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owner.controller.js","sourceRoot":"","sources":["../../src/controllers/owner.controller.ts"],"names":[],"mappings":";;AAOA,kDAwCC;AA9CD,2CAAkF;AAClF,mEAA4D;AAC5D,gEAEoC;AAEpC,SAAgB,mBAAmB,CAAC,GAAY;IAC9C,MAAM,GAAG,GAAG,gBAAS,CAAC,GAAG,CAAC,+BAAY,CAAC,CAAC;IAExC,GAAG,CAAC,GAAG,CAAC,yBAAyB,EAAE,IAAA,mBAAY,EAAC,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;QACpF,MAAM,MAAM,GAAG,kCAAgB,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrD,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,MAAM,eAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,eAAe,CAAC,CAAC;QACnG,MAAM,MAAM,GAAG,MAAM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