Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

Merge branch 'main' into dev

Brad Barbina8ebd2725a29
diff --cc apps/carbon/app/modules/resources/resources.service.ts
index d09937095a,cc857ca99b..9a293c883d
--- a/apps/carbon/app/modules/resources/resources.service.ts
+++ b/apps/carbon/app/modules/resources/resources.service.ts
@@@ -555,66 -543,6 +559,7 @@@ export async function getPartners
return query;
}
- export async function getShift(
- client: SupabaseClient<Database>,
- shiftId: string
- ) {
- return client
- .from("shift")
- .select(
- `id, name, startTime, endTime, locationId,
- monday, tuesday, wednesday, thursday, friday, saturday, sunday,
- employeeShift(user(id, fullName, avatarUrl)), location(name, timezone)`
- )
- .eq("id", shiftId)
- .eq("active", true)
- .single();
- }
-
- export async function getShifts(
- client: SupabaseClient<Database>,
- args: GenericQueryFilters & { name: string | null; location: string | null }
- ) {
- let query = client
- .from("shift")
- .select(
- `id, name, startTime, endTime, locationId,
- monday, tuesday, wednesday, thursday, friday, saturday, sunday,
- employeeShift(user(id, fullName, avatarUrl)), location(name, timezone)`,
- {
- count: "exact",
- }
- )
- .eq("active", true)
- .eq("employeeShift.user.active", true);
-
- if (args?.name) {
- query = query.ilike("name", `%${args.name}%`);
- }
-
- if (args.location) {
- query = query.eq("locationId", args.location);
- }
-
- query = setGenericQueryFilters(query, args, [
- { column: "locationId", ascending: true },
- ]);
- return query;
- }
-
- export async function getShiftsList(
- client: SupabaseClient<Database>,
- locationId: string | null
- ) {
- let query = client.from("shift").select(`id, name`).eq("active", true);
-
- if (locationId) {
- query = query.eq("locationId", locationId);
- }
-
- return query.order("name");
- }
+
type UserAttributeId = string;
export type PersonAttributeValue = {
@@@ -714,6 -642,64 +659,66 @@@ export async function getPeople
};
}
+ export async function getShift(
+ client: SupabaseClient<Database>,
+ shiftId: string
+ ) {
+ return client
+ .from("shift")
+ .select(
+ `id, name, startTime, endTime, locationId,
+ monday, tuesday, wednesday, thursday, friday, saturday, sunday,
+ employeeShift(user(id, fullName, avatarUrl)), location(name, timezone)`
+ )
+ .eq("id", shiftId)
+ .eq("active", true)
+ .single();
+ }
+
+ export async function getShifts(
+ client: SupabaseClient<Database>,
+ args: GenericQueryFilters & { name: string | null; location: string | null }
+ ) {
+ let query = client
+ .from("shift")
+ .select(
+ `id, name, startTime, endTime, locationId,
+ monday, tuesday, wednesday, thursday, friday, saturday, sunday,
+ employeeShift(user(id, fullName, avatarUrl)), location(name, timezone)`,
+ {
+ count: "exact",
+ }
+ )
+ .eq("active", true)
+ .eq("employeeShift.user.active", true);
+
+ if (args?.name) {
+ query = query.ilike("name", `%${args.name}%`);
+ }
+
+ if (args.location) {
+ query = query.eq("locationId", args.location);
+ }
+
- query = setGenericQueryFilters(query, args, "locationId");
++ query = setGenericQueryFilters(query, args, [
++ { column: "locationId", ascending: true },
++ ]);
+ return query;
+ }
+
+ export async function getShiftsList(
+ client: SupabaseClient<Database>,
+ locationId: string | null
+ ) {
+ let query = client.from("shift").select(`id, name`).eq("active", true);
+
+ if (locationId) {
+ query = query.eq("locationId", locationId);
+ }
+
+ return query.order("name");
+ }
+
export async function getWorkCell(
client: SupabaseClient<Database>,
workCellId: string