@voyantjs/resources 0.1.0
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/LICENSE +109 -0
- package/README.md +34 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/routes.d.ts +1214 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +330 -0
- package/dist/schema.d.ts +1149 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +164 -0
- package/dist/service.d.ts +372 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +287 -0
- package/dist/validation.d.ts +335 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +111 -0
- package/package.json +51 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,gBAAgB,kGAO3B,CAAA;AAEF,eAAO,MAAM,0BAA0B,+DAGrC,CAAA;AAEF,eAAO,MAAM,4BAA4B,sGAMvC,CAAA;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBrB,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBzB,CAAA;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;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Y,CAAA;AAC1E,MAAM,MAAM,sBAAsB,GAAG,OAAO,oBAAoB,CAAC,YAAY,CAAA;AAC7E,MAAM,MAAM,sBAAsB,GAAG,OAAO,uBAAuB,CAAC,YAAY,CAAA;AAChF,MAAM,MAAM,yBAAyB,GAAG,OAAO,uBAAuB,CAAC,YAAY,CAAA;AACnF,MAAM,MAAM,gBAAgB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAA;AACpE,MAAM,MAAM,mBAAmB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAA;AAEvE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAuB,CAAA;AACvD,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,CAAA;AACpD,MAAM,MAAM,qBAAqB,GAAG,sBAAsB,CAAA;AAE1D,eAAO,MAAM,kBAAkB;;;;EAI5B,CAAA;AAEH,eAAO,MAAM,sBAAsB;;;;;EAKhC,CAAA;AAEH,eAAO,MAAM,4BAA4B;;;EAStC,CAAA;AAEH,eAAO,MAAM,6BAA6B;;EAKvC,CAAA;AAEH,eAAO,MAAM,4BAA4B;;EAAgC,CAAA;AAEzE,eAAO,MAAM,gCAAgC;;;EAS1C,CAAA;AAEH,eAAO,MAAM,0BAA0B;;EAKpC,CAAA"}
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { typeId, typeIdRef } from "@voyantjs/db/lib/typeid-column";
|
|
2
|
+
import { relations } from "drizzle-orm";
|
|
3
|
+
import { boolean, date, index, integer, pgEnum, pgTable, text, timestamp, } from "drizzle-orm/pg-core";
|
|
4
|
+
export const resourceKindEnum = pgEnum("resource_kind", [
|
|
5
|
+
"guide",
|
|
6
|
+
"vehicle",
|
|
7
|
+
"room",
|
|
8
|
+
"boat",
|
|
9
|
+
"equipment",
|
|
10
|
+
"other",
|
|
11
|
+
]);
|
|
12
|
+
export const resourceAllocationModeEnum = pgEnum("resource_allocation_mode", [
|
|
13
|
+
"shared",
|
|
14
|
+
"exclusive",
|
|
15
|
+
]);
|
|
16
|
+
export const resourceAssignmentStatusEnum = pgEnum("resource_assignment_status", [
|
|
17
|
+
"reserved",
|
|
18
|
+
"assigned",
|
|
19
|
+
"released",
|
|
20
|
+
"cancelled",
|
|
21
|
+
"completed",
|
|
22
|
+
]);
|
|
23
|
+
export const resources = pgTable("resources", {
|
|
24
|
+
id: typeId("resources"),
|
|
25
|
+
supplierId: text("supplier_id"),
|
|
26
|
+
facilityId: text("facility_id"),
|
|
27
|
+
kind: resourceKindEnum("kind").notNull(),
|
|
28
|
+
name: text("name").notNull(),
|
|
29
|
+
code: text("code"),
|
|
30
|
+
capacity: integer("capacity"),
|
|
31
|
+
active: boolean("active").notNull().default(true),
|
|
32
|
+
notes: text("notes"),
|
|
33
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
34
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
35
|
+
}, (table) => [
|
|
36
|
+
index("idx_resources_supplier").on(table.supplierId),
|
|
37
|
+
index("idx_resources_facility").on(table.facilityId),
|
|
38
|
+
index("idx_resources_kind").on(table.kind),
|
|
39
|
+
index("idx_resources_active").on(table.active),
|
|
40
|
+
]);
|
|
41
|
+
export const resourcePools = pgTable("resource_pools", {
|
|
42
|
+
id: typeId("resource_pools"),
|
|
43
|
+
productId: text("product_id"),
|
|
44
|
+
kind: resourceKindEnum("kind").notNull(),
|
|
45
|
+
name: text("name").notNull(),
|
|
46
|
+
sharedCapacity: integer("shared_capacity"),
|
|
47
|
+
active: boolean("active").notNull().default(true),
|
|
48
|
+
notes: text("notes"),
|
|
49
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
50
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
51
|
+
}, (table) => [
|
|
52
|
+
index("idx_resource_pools_product").on(table.productId),
|
|
53
|
+
index("idx_resource_pools_kind").on(table.kind),
|
|
54
|
+
index("idx_resource_pools_active").on(table.active),
|
|
55
|
+
]);
|
|
56
|
+
export const resourcePoolMembers = pgTable("resource_pool_members", {
|
|
57
|
+
id: typeId("resource_pool_members"),
|
|
58
|
+
poolId: typeIdRef("pool_id")
|
|
59
|
+
.notNull()
|
|
60
|
+
.references(() => resourcePools.id, { onDelete: "cascade" }),
|
|
61
|
+
resourceId: typeIdRef("resource_id")
|
|
62
|
+
.notNull()
|
|
63
|
+
.references(() => resources.id, { onDelete: "cascade" }),
|
|
64
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
65
|
+
}, (table) => [
|
|
66
|
+
index("idx_resource_pool_members_pool").on(table.poolId),
|
|
67
|
+
index("idx_resource_pool_members_resource").on(table.resourceId),
|
|
68
|
+
]);
|
|
69
|
+
export const resourceRequirements = pgTable("resource_requirements", {
|
|
70
|
+
id: typeId("resource_requirements"),
|
|
71
|
+
poolId: typeIdRef("pool_id")
|
|
72
|
+
.notNull()
|
|
73
|
+
.references(() => resourcePools.id, { onDelete: "cascade" }),
|
|
74
|
+
productId: text("product_id").notNull(),
|
|
75
|
+
availabilityRuleId: text("availability_rule_id"),
|
|
76
|
+
startTimeId: text("start_time_id"),
|
|
77
|
+
quantityRequired: integer("quantity_required").notNull().default(1),
|
|
78
|
+
allocationMode: resourceAllocationModeEnum("allocation_mode").notNull().default("shared"),
|
|
79
|
+
priority: integer("priority").notNull().default(0),
|
|
80
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
81
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
82
|
+
}, (table) => [
|
|
83
|
+
index("idx_resource_requirements_pool").on(table.poolId),
|
|
84
|
+
index("idx_resource_requirements_product").on(table.productId),
|
|
85
|
+
index("idx_resource_requirements_rule").on(table.availabilityRuleId),
|
|
86
|
+
index("idx_resource_requirements_start_time").on(table.startTimeId),
|
|
87
|
+
]);
|
|
88
|
+
export const resourceSlotAssignments = pgTable("resource_slot_assignments", {
|
|
89
|
+
id: typeId("resource_slot_assignments"),
|
|
90
|
+
slotId: text("slot_id").notNull(),
|
|
91
|
+
poolId: typeIdRef("pool_id").references(() => resourcePools.id, { onDelete: "set null" }),
|
|
92
|
+
resourceId: typeIdRef("resource_id").references(() => resources.id, { onDelete: "set null" }),
|
|
93
|
+
bookingId: text("booking_id"),
|
|
94
|
+
status: resourceAssignmentStatusEnum("status").notNull().default("reserved"),
|
|
95
|
+
assignedAt: timestamp("assigned_at", { withTimezone: true }).notNull().defaultNow(),
|
|
96
|
+
assignedBy: text("assigned_by"),
|
|
97
|
+
releasedAt: timestamp("released_at", { withTimezone: true }),
|
|
98
|
+
notes: text("notes"),
|
|
99
|
+
}, (table) => [
|
|
100
|
+
index("idx_resource_slot_assignments_slot").on(table.slotId),
|
|
101
|
+
index("idx_resource_slot_assignments_pool").on(table.poolId),
|
|
102
|
+
index("idx_resource_slot_assignments_resource").on(table.resourceId),
|
|
103
|
+
index("idx_resource_slot_assignments_booking").on(table.bookingId),
|
|
104
|
+
]);
|
|
105
|
+
export const resourceCloseouts = pgTable("resource_closeouts", {
|
|
106
|
+
id: typeId("resource_closeouts"),
|
|
107
|
+
resourceId: typeIdRef("resource_id")
|
|
108
|
+
.notNull()
|
|
109
|
+
.references(() => resources.id, { onDelete: "cascade" }),
|
|
110
|
+
dateLocal: date("date_local").notNull(),
|
|
111
|
+
startsAt: timestamp("starts_at", { withTimezone: true }),
|
|
112
|
+
endsAt: timestamp("ends_at", { withTimezone: true }),
|
|
113
|
+
reason: text("reason"),
|
|
114
|
+
createdBy: text("created_by"),
|
|
115
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
116
|
+
}, (table) => [
|
|
117
|
+
index("idx_resource_closeouts_resource").on(table.resourceId),
|
|
118
|
+
index("idx_resource_closeouts_date").on(table.dateLocal),
|
|
119
|
+
]);
|
|
120
|
+
export const resourceAllocations = resourceRequirements;
|
|
121
|
+
export const resourcesRelations = relations(resources, ({ many }) => ({
|
|
122
|
+
poolMembers: many(resourcePoolMembers),
|
|
123
|
+
slotAssignments: many(resourceSlotAssignments),
|
|
124
|
+
closeouts: many(resourceCloseouts),
|
|
125
|
+
}));
|
|
126
|
+
export const resourcePoolsRelations = relations(resourcePools, ({ many }) => ({
|
|
127
|
+
members: many(resourcePoolMembers),
|
|
128
|
+
requirements: many(resourceRequirements),
|
|
129
|
+
allocations: many(resourceRequirements),
|
|
130
|
+
slotAssignments: many(resourceSlotAssignments),
|
|
131
|
+
}));
|
|
132
|
+
export const resourcePoolMembersRelations = relations(resourcePoolMembers, ({ one }) => ({
|
|
133
|
+
pool: one(resourcePools, {
|
|
134
|
+
fields: [resourcePoolMembers.poolId],
|
|
135
|
+
references: [resourcePools.id],
|
|
136
|
+
}),
|
|
137
|
+
resource: one(resources, {
|
|
138
|
+
fields: [resourcePoolMembers.resourceId],
|
|
139
|
+
references: [resources.id],
|
|
140
|
+
}),
|
|
141
|
+
}));
|
|
142
|
+
export const resourceRequirementsRelations = relations(resourceRequirements, ({ one }) => ({
|
|
143
|
+
pool: one(resourcePools, {
|
|
144
|
+
fields: [resourceRequirements.poolId],
|
|
145
|
+
references: [resourcePools.id],
|
|
146
|
+
}),
|
|
147
|
+
}));
|
|
148
|
+
export const resourceAllocationsRelations = resourceRequirementsRelations;
|
|
149
|
+
export const resourceSlotAssignmentsRelations = relations(resourceSlotAssignments, ({ one }) => ({
|
|
150
|
+
pool: one(resourcePools, {
|
|
151
|
+
fields: [resourceSlotAssignments.poolId],
|
|
152
|
+
references: [resourcePools.id],
|
|
153
|
+
}),
|
|
154
|
+
resource: one(resources, {
|
|
155
|
+
fields: [resourceSlotAssignments.resourceId],
|
|
156
|
+
references: [resources.id],
|
|
157
|
+
}),
|
|
158
|
+
}));
|
|
159
|
+
export const resourceCloseoutsRelations = relations(resourceCloseouts, ({ one }) => ({
|
|
160
|
+
resource: one(resources, {
|
|
161
|
+
fields: [resourceCloseouts.resourceId],
|
|
162
|
+
references: [resources.id],
|
|
163
|
+
}),
|
|
164
|
+
}));
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
import type { insertResourceCloseoutSchema, insertResourcePoolMemberSchema, insertResourcePoolSchema, insertResourceRequirementSchema, insertResourceSchema, insertResourceSlotAssignmentSchema, resourceCloseoutListQuerySchema, resourceListQuerySchema, resourcePoolListQuerySchema, resourcePoolMemberListQuerySchema, resourceRequirementListQuerySchema, resourceSlotAssignmentListQuerySchema, updateResourceCloseoutSchema, updateResourcePoolSchema, updateResourceRequirementSchema, updateResourceSchema, updateResourceSlotAssignmentSchema } from "./validation.js";
|
|
4
|
+
type ResourceListQuery = z.infer<typeof resourceListQuerySchema>;
|
|
5
|
+
type ResourcePoolListQuery = z.infer<typeof resourcePoolListQuerySchema>;
|
|
6
|
+
type ResourcePoolMemberListQuery = z.infer<typeof resourcePoolMemberListQuerySchema>;
|
|
7
|
+
type ResourceRequirementListQuery = z.infer<typeof resourceRequirementListQuerySchema>;
|
|
8
|
+
type ResourceSlotAssignmentListQuery = z.infer<typeof resourceSlotAssignmentListQuerySchema>;
|
|
9
|
+
type ResourceCloseoutListQuery = z.infer<typeof resourceCloseoutListQuerySchema>;
|
|
10
|
+
type CreateResourceInput = z.infer<typeof insertResourceSchema>;
|
|
11
|
+
type UpdateResourceInput = z.infer<typeof updateResourceSchema>;
|
|
12
|
+
type CreateResourcePoolInput = z.infer<typeof insertResourcePoolSchema>;
|
|
13
|
+
type UpdateResourcePoolInput = z.infer<typeof updateResourcePoolSchema>;
|
|
14
|
+
type CreateResourcePoolMemberInput = z.infer<typeof insertResourcePoolMemberSchema>;
|
|
15
|
+
type CreateResourceRequirementInput = z.infer<typeof insertResourceRequirementSchema>;
|
|
16
|
+
type UpdateResourceRequirementInput = z.infer<typeof updateResourceRequirementSchema>;
|
|
17
|
+
type CreateResourceSlotAssignmentInput = z.infer<typeof insertResourceSlotAssignmentSchema>;
|
|
18
|
+
type UpdateResourceSlotAssignmentInput = z.infer<typeof updateResourceSlotAssignmentSchema>;
|
|
19
|
+
type CreateResourceCloseoutInput = z.infer<typeof insertResourceCloseoutSchema>;
|
|
20
|
+
type UpdateResourceCloseoutInput = z.infer<typeof updateResourceCloseoutSchema>;
|
|
21
|
+
export declare const resourcesService: {
|
|
22
|
+
listResources(db: PostgresJsDatabase, query: ResourceListQuery): Promise<{
|
|
23
|
+
data: {
|
|
24
|
+
id: string;
|
|
25
|
+
supplierId: string | null;
|
|
26
|
+
facilityId: string | null;
|
|
27
|
+
kind: "guide" | "vehicle" | "room" | "boat" | "equipment" | "other";
|
|
28
|
+
name: string;
|
|
29
|
+
code: string | null;
|
|
30
|
+
capacity: number | null;
|
|
31
|
+
active: boolean;
|
|
32
|
+
notes: string | null;
|
|
33
|
+
createdAt: Date;
|
|
34
|
+
updatedAt: Date;
|
|
35
|
+
}[];
|
|
36
|
+
total: number;
|
|
37
|
+
limit: number;
|
|
38
|
+
offset: number;
|
|
39
|
+
}>;
|
|
40
|
+
getResourceById(db: PostgresJsDatabase, id: string): Promise<{
|
|
41
|
+
id: string;
|
|
42
|
+
supplierId: string | null;
|
|
43
|
+
facilityId: string | null;
|
|
44
|
+
kind: "guide" | "vehicle" | "room" | "boat" | "equipment" | "other";
|
|
45
|
+
name: string;
|
|
46
|
+
code: string | null;
|
|
47
|
+
capacity: number | null;
|
|
48
|
+
active: boolean;
|
|
49
|
+
notes: string | null;
|
|
50
|
+
createdAt: Date;
|
|
51
|
+
updatedAt: Date;
|
|
52
|
+
} | null>;
|
|
53
|
+
createResource(db: PostgresJsDatabase, data: CreateResourceInput): Promise<{
|
|
54
|
+
id: string;
|
|
55
|
+
name: string;
|
|
56
|
+
supplierId: string | null;
|
|
57
|
+
facilityId: string | null;
|
|
58
|
+
kind: "guide" | "vehicle" | "room" | "boat" | "equipment" | "other";
|
|
59
|
+
code: string | null;
|
|
60
|
+
capacity: number | null;
|
|
61
|
+
active: boolean;
|
|
62
|
+
notes: string | null;
|
|
63
|
+
createdAt: Date;
|
|
64
|
+
updatedAt: Date;
|
|
65
|
+
} | undefined>;
|
|
66
|
+
updateResource(db: PostgresJsDatabase, id: string, data: UpdateResourceInput): Promise<{
|
|
67
|
+
id: string;
|
|
68
|
+
supplierId: string | null;
|
|
69
|
+
facilityId: string | null;
|
|
70
|
+
kind: "guide" | "vehicle" | "room" | "boat" | "equipment" | "other";
|
|
71
|
+
name: string;
|
|
72
|
+
code: string | null;
|
|
73
|
+
capacity: number | null;
|
|
74
|
+
active: boolean;
|
|
75
|
+
notes: string | null;
|
|
76
|
+
createdAt: Date;
|
|
77
|
+
updatedAt: Date;
|
|
78
|
+
} | null>;
|
|
79
|
+
deleteResource(db: PostgresJsDatabase, id: string): Promise<{
|
|
80
|
+
id: string;
|
|
81
|
+
} | null>;
|
|
82
|
+
listPools(db: PostgresJsDatabase, query: ResourcePoolListQuery): Promise<{
|
|
83
|
+
data: {
|
|
84
|
+
id: string;
|
|
85
|
+
productId: string | null;
|
|
86
|
+
kind: "guide" | "vehicle" | "room" | "boat" | "equipment" | "other";
|
|
87
|
+
name: string;
|
|
88
|
+
sharedCapacity: number | null;
|
|
89
|
+
active: boolean;
|
|
90
|
+
notes: string | null;
|
|
91
|
+
createdAt: Date;
|
|
92
|
+
updatedAt: Date;
|
|
93
|
+
}[];
|
|
94
|
+
total: number;
|
|
95
|
+
limit: number;
|
|
96
|
+
offset: number;
|
|
97
|
+
}>;
|
|
98
|
+
getPoolById(db: PostgresJsDatabase, id: string): Promise<{
|
|
99
|
+
id: string;
|
|
100
|
+
productId: string | null;
|
|
101
|
+
kind: "guide" | "vehicle" | "room" | "boat" | "equipment" | "other";
|
|
102
|
+
name: string;
|
|
103
|
+
sharedCapacity: number | null;
|
|
104
|
+
active: boolean;
|
|
105
|
+
notes: string | null;
|
|
106
|
+
createdAt: Date;
|
|
107
|
+
updatedAt: Date;
|
|
108
|
+
} | null>;
|
|
109
|
+
createPool(db: PostgresJsDatabase, data: CreateResourcePoolInput): Promise<{
|
|
110
|
+
id: string;
|
|
111
|
+
name: string;
|
|
112
|
+
kind: "guide" | "vehicle" | "room" | "boat" | "equipment" | "other";
|
|
113
|
+
active: boolean;
|
|
114
|
+
notes: string | null;
|
|
115
|
+
createdAt: Date;
|
|
116
|
+
updatedAt: Date;
|
|
117
|
+
productId: string | null;
|
|
118
|
+
sharedCapacity: number | null;
|
|
119
|
+
} | undefined>;
|
|
120
|
+
updatePool(db: PostgresJsDatabase, id: string, data: UpdateResourcePoolInput): Promise<{
|
|
121
|
+
id: string;
|
|
122
|
+
productId: string | null;
|
|
123
|
+
kind: "guide" | "vehicle" | "room" | "boat" | "equipment" | "other";
|
|
124
|
+
name: string;
|
|
125
|
+
sharedCapacity: number | null;
|
|
126
|
+
active: boolean;
|
|
127
|
+
notes: string | null;
|
|
128
|
+
createdAt: Date;
|
|
129
|
+
updatedAt: Date;
|
|
130
|
+
} | null>;
|
|
131
|
+
deletePool(db: PostgresJsDatabase, id: string): Promise<{
|
|
132
|
+
id: string;
|
|
133
|
+
} | null>;
|
|
134
|
+
listPoolMembers(db: PostgresJsDatabase, query: ResourcePoolMemberListQuery): Promise<{
|
|
135
|
+
data: {
|
|
136
|
+
id: string;
|
|
137
|
+
poolId: string;
|
|
138
|
+
resourceId: string;
|
|
139
|
+
createdAt: Date;
|
|
140
|
+
}[];
|
|
141
|
+
total: number;
|
|
142
|
+
limit: number;
|
|
143
|
+
offset: number;
|
|
144
|
+
}>;
|
|
145
|
+
createPoolMember(db: PostgresJsDatabase, data: CreateResourcePoolMemberInput): Promise<{
|
|
146
|
+
id: string;
|
|
147
|
+
createdAt: Date;
|
|
148
|
+
poolId: string;
|
|
149
|
+
resourceId: string;
|
|
150
|
+
} | undefined>;
|
|
151
|
+
deletePoolMember(db: PostgresJsDatabase, id: string): Promise<{
|
|
152
|
+
id: string;
|
|
153
|
+
} | null>;
|
|
154
|
+
listRequirements(db: PostgresJsDatabase, query: ResourceRequirementListQuery): Promise<{
|
|
155
|
+
data: {
|
|
156
|
+
id: string;
|
|
157
|
+
poolId: string;
|
|
158
|
+
productId: string;
|
|
159
|
+
availabilityRuleId: string | null;
|
|
160
|
+
startTimeId: string | null;
|
|
161
|
+
quantityRequired: number;
|
|
162
|
+
allocationMode: "shared" | "exclusive";
|
|
163
|
+
priority: number;
|
|
164
|
+
createdAt: Date;
|
|
165
|
+
updatedAt: Date;
|
|
166
|
+
}[];
|
|
167
|
+
total: number;
|
|
168
|
+
limit: number;
|
|
169
|
+
offset: number;
|
|
170
|
+
}>;
|
|
171
|
+
getRequirementById(db: PostgresJsDatabase, id: string): Promise<{
|
|
172
|
+
id: string;
|
|
173
|
+
poolId: string;
|
|
174
|
+
productId: string;
|
|
175
|
+
availabilityRuleId: string | null;
|
|
176
|
+
startTimeId: string | null;
|
|
177
|
+
quantityRequired: number;
|
|
178
|
+
allocationMode: "shared" | "exclusive";
|
|
179
|
+
priority: number;
|
|
180
|
+
createdAt: Date;
|
|
181
|
+
updatedAt: Date;
|
|
182
|
+
} | null>;
|
|
183
|
+
createRequirement(db: PostgresJsDatabase, data: CreateResourceRequirementInput): Promise<{
|
|
184
|
+
id: string;
|
|
185
|
+
createdAt: Date;
|
|
186
|
+
updatedAt: Date;
|
|
187
|
+
productId: string;
|
|
188
|
+
poolId: string;
|
|
189
|
+
availabilityRuleId: string | null;
|
|
190
|
+
startTimeId: string | null;
|
|
191
|
+
quantityRequired: number;
|
|
192
|
+
allocationMode: "shared" | "exclusive";
|
|
193
|
+
priority: number;
|
|
194
|
+
} | undefined>;
|
|
195
|
+
updateRequirement(db: PostgresJsDatabase, id: string, data: UpdateResourceRequirementInput): Promise<{
|
|
196
|
+
id: string;
|
|
197
|
+
poolId: string;
|
|
198
|
+
productId: string;
|
|
199
|
+
availabilityRuleId: string | null;
|
|
200
|
+
startTimeId: string | null;
|
|
201
|
+
quantityRequired: number;
|
|
202
|
+
allocationMode: "shared" | "exclusive";
|
|
203
|
+
priority: number;
|
|
204
|
+
createdAt: Date;
|
|
205
|
+
updatedAt: Date;
|
|
206
|
+
} | null>;
|
|
207
|
+
deleteRequirement(db: PostgresJsDatabase, id: string): Promise<{
|
|
208
|
+
id: string;
|
|
209
|
+
} | null>;
|
|
210
|
+
listAllocations(db: PostgresJsDatabase, query: ResourceRequirementListQuery): Promise<{
|
|
211
|
+
data: {
|
|
212
|
+
id: string;
|
|
213
|
+
poolId: string;
|
|
214
|
+
productId: string;
|
|
215
|
+
availabilityRuleId: string | null;
|
|
216
|
+
startTimeId: string | null;
|
|
217
|
+
quantityRequired: number;
|
|
218
|
+
allocationMode: "shared" | "exclusive";
|
|
219
|
+
priority: number;
|
|
220
|
+
createdAt: Date;
|
|
221
|
+
updatedAt: Date;
|
|
222
|
+
}[];
|
|
223
|
+
total: number;
|
|
224
|
+
limit: number;
|
|
225
|
+
offset: number;
|
|
226
|
+
}>;
|
|
227
|
+
getAllocationById(db: PostgresJsDatabase, id: string): Promise<{
|
|
228
|
+
id: string;
|
|
229
|
+
poolId: string;
|
|
230
|
+
productId: string;
|
|
231
|
+
availabilityRuleId: string | null;
|
|
232
|
+
startTimeId: string | null;
|
|
233
|
+
quantityRequired: number;
|
|
234
|
+
allocationMode: "shared" | "exclusive";
|
|
235
|
+
priority: number;
|
|
236
|
+
createdAt: Date;
|
|
237
|
+
updatedAt: Date;
|
|
238
|
+
} | null>;
|
|
239
|
+
createAllocation(db: PostgresJsDatabase, data: CreateResourceRequirementInput): Promise<{
|
|
240
|
+
id: string;
|
|
241
|
+
createdAt: Date;
|
|
242
|
+
updatedAt: Date;
|
|
243
|
+
productId: string;
|
|
244
|
+
poolId: string;
|
|
245
|
+
availabilityRuleId: string | null;
|
|
246
|
+
startTimeId: string | null;
|
|
247
|
+
quantityRequired: number;
|
|
248
|
+
allocationMode: "shared" | "exclusive";
|
|
249
|
+
priority: number;
|
|
250
|
+
} | undefined>;
|
|
251
|
+
updateAllocation(db: PostgresJsDatabase, id: string, data: UpdateResourceRequirementInput): Promise<{
|
|
252
|
+
id: string;
|
|
253
|
+
poolId: string;
|
|
254
|
+
productId: string;
|
|
255
|
+
availabilityRuleId: string | null;
|
|
256
|
+
startTimeId: string | null;
|
|
257
|
+
quantityRequired: number;
|
|
258
|
+
allocationMode: "shared" | "exclusive";
|
|
259
|
+
priority: number;
|
|
260
|
+
createdAt: Date;
|
|
261
|
+
updatedAt: Date;
|
|
262
|
+
} | null>;
|
|
263
|
+
deleteAllocation(db: PostgresJsDatabase, id: string): Promise<{
|
|
264
|
+
id: string;
|
|
265
|
+
} | null>;
|
|
266
|
+
listSlotAssignments(db: PostgresJsDatabase, query: ResourceSlotAssignmentListQuery): Promise<{
|
|
267
|
+
data: {
|
|
268
|
+
id: string;
|
|
269
|
+
slotId: string;
|
|
270
|
+
poolId: string | null;
|
|
271
|
+
resourceId: string | null;
|
|
272
|
+
bookingId: string | null;
|
|
273
|
+
status: "reserved" | "assigned" | "released" | "cancelled" | "completed";
|
|
274
|
+
assignedAt: Date;
|
|
275
|
+
assignedBy: string | null;
|
|
276
|
+
releasedAt: Date | null;
|
|
277
|
+
notes: string | null;
|
|
278
|
+
}[];
|
|
279
|
+
total: number;
|
|
280
|
+
limit: number;
|
|
281
|
+
offset: number;
|
|
282
|
+
}>;
|
|
283
|
+
getSlotAssignmentById(db: PostgresJsDatabase, id: string): Promise<{
|
|
284
|
+
id: string;
|
|
285
|
+
slotId: string;
|
|
286
|
+
poolId: string | null;
|
|
287
|
+
resourceId: string | null;
|
|
288
|
+
bookingId: string | null;
|
|
289
|
+
status: "reserved" | "assigned" | "released" | "cancelled" | "completed";
|
|
290
|
+
assignedAt: Date;
|
|
291
|
+
assignedBy: string | null;
|
|
292
|
+
releasedAt: Date | null;
|
|
293
|
+
notes: string | null;
|
|
294
|
+
} | null>;
|
|
295
|
+
createSlotAssignment(db: PostgresJsDatabase, data: CreateResourceSlotAssignmentInput): Promise<{
|
|
296
|
+
id: string;
|
|
297
|
+
notes: string | null;
|
|
298
|
+
poolId: string | null;
|
|
299
|
+
resourceId: string | null;
|
|
300
|
+
slotId: string;
|
|
301
|
+
bookingId: string | null;
|
|
302
|
+
status: "reserved" | "assigned" | "released" | "cancelled" | "completed";
|
|
303
|
+
assignedAt: Date;
|
|
304
|
+
assignedBy: string | null;
|
|
305
|
+
releasedAt: Date | null;
|
|
306
|
+
} | undefined>;
|
|
307
|
+
updateSlotAssignment(db: PostgresJsDatabase, id: string, data: UpdateResourceSlotAssignmentInput): Promise<{
|
|
308
|
+
id: string;
|
|
309
|
+
slotId: string;
|
|
310
|
+
poolId: string | null;
|
|
311
|
+
resourceId: string | null;
|
|
312
|
+
bookingId: string | null;
|
|
313
|
+
status: "reserved" | "assigned" | "released" | "cancelled" | "completed";
|
|
314
|
+
assignedAt: Date;
|
|
315
|
+
assignedBy: string | null;
|
|
316
|
+
releasedAt: Date | null;
|
|
317
|
+
notes: string | null;
|
|
318
|
+
} | null>;
|
|
319
|
+
deleteSlotAssignment(db: PostgresJsDatabase, id: string): Promise<{
|
|
320
|
+
id: string;
|
|
321
|
+
} | null>;
|
|
322
|
+
listCloseouts(db: PostgresJsDatabase, query: ResourceCloseoutListQuery): Promise<{
|
|
323
|
+
data: {
|
|
324
|
+
id: string;
|
|
325
|
+
resourceId: string;
|
|
326
|
+
dateLocal: string;
|
|
327
|
+
startsAt: Date | null;
|
|
328
|
+
endsAt: Date | null;
|
|
329
|
+
reason: string | null;
|
|
330
|
+
createdBy: string | null;
|
|
331
|
+
createdAt: Date;
|
|
332
|
+
}[];
|
|
333
|
+
total: number;
|
|
334
|
+
limit: number;
|
|
335
|
+
offset: number;
|
|
336
|
+
}>;
|
|
337
|
+
getCloseoutById(db: PostgresJsDatabase, id: string): Promise<{
|
|
338
|
+
id: string;
|
|
339
|
+
resourceId: string;
|
|
340
|
+
dateLocal: string;
|
|
341
|
+
startsAt: Date | null;
|
|
342
|
+
endsAt: Date | null;
|
|
343
|
+
reason: string | null;
|
|
344
|
+
createdBy: string | null;
|
|
345
|
+
createdAt: Date;
|
|
346
|
+
} | null>;
|
|
347
|
+
createCloseout(db: PostgresJsDatabase, data: CreateResourceCloseoutInput): Promise<{
|
|
348
|
+
id: string;
|
|
349
|
+
createdAt: Date;
|
|
350
|
+
resourceId: string;
|
|
351
|
+
dateLocal: string;
|
|
352
|
+
startsAt: Date | null;
|
|
353
|
+
endsAt: Date | null;
|
|
354
|
+
reason: string | null;
|
|
355
|
+
createdBy: string | null;
|
|
356
|
+
} | undefined>;
|
|
357
|
+
updateCloseout(db: PostgresJsDatabase, id: string, data: UpdateResourceCloseoutInput): Promise<{
|
|
358
|
+
id: string;
|
|
359
|
+
resourceId: string;
|
|
360
|
+
dateLocal: string;
|
|
361
|
+
startsAt: Date | null;
|
|
362
|
+
endsAt: Date | null;
|
|
363
|
+
reason: string | null;
|
|
364
|
+
createdBy: string | null;
|
|
365
|
+
createdAt: Date;
|
|
366
|
+
} | null>;
|
|
367
|
+
deleteCloseout(db: PostgresJsDatabase, id: string): Promise<{
|
|
368
|
+
id: string;
|
|
369
|
+
} | null>;
|
|
370
|
+
};
|
|
371
|
+
export {};
|
|
372
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAU5B,OAAO,KAAK,EACV,4BAA4B,EAC5B,8BAA8B,EAC9B,wBAAwB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