fix basic errors
This commit is contained in:
parent
23d1f60fc7
commit
d9e9a16f42
@ -1,6 +1,4 @@
|
||||
import { ApolloProvider } from '@apollo/client'
|
||||
import { CssBaseline, ThemeProvider, createTheme, CircularProgress, Box } from '@mui/material'
|
||||
import { client } from './graphql/client'
|
||||
import { useDeviceType } from './hooks/useDeviceType'
|
||||
import { useTaskData } from './hooks/useTaskData'
|
||||
import { DesktopLayout } from './layouts/DesktopLayout'
|
||||
@ -44,42 +42,40 @@ export function App() {
|
||||
}
|
||||
|
||||
return (
|
||||
<ApolloProvider client={client}>
|
||||
<ThemeProvider theme={theme}>
|
||||
<CssBaseline />
|
||||
{deviceType === 'desktop' ? (
|
||||
<DesktopLayout
|
||||
groups={groups as any}
|
||||
selectedGroup={selectedGroup as any}
|
||||
selectedTask={selectedTask as any}
|
||||
selectedStep={selectedStep as any}
|
||||
onGroupSelect={setSelectedGroup as any}
|
||||
onTaskSelect={setSelectedTask as any}
|
||||
onStepSelect={setSelectedStep as any}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
{selectedStep ? (
|
||||
<StepDetails
|
||||
step={step!}
|
||||
onPrint={() => handlePrintStep(String(selectedStep.id), '1')} // TODO: Get real user ID
|
||||
onAddNote={(content) => handleAddNote(content, '1')} // TODO: Get real user ID
|
||||
/>
|
||||
) : (
|
||||
<MobileLayout
|
||||
groups={groups as any}
|
||||
selectedGroup={selectedGroup as any}
|
||||
selectedTask={selectedTask as any}
|
||||
selectedStep={selectedStep as any}
|
||||
onGroupSelect={setSelectedGroup as any}
|
||||
onTaskSelect={setSelectedTask as any}
|
||||
onStepSelect={setSelectedStep as any}
|
||||
onBack={handleBack}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</ThemeProvider>
|
||||
</ApolloProvider>
|
||||
<ThemeProvider theme={theme}>
|
||||
<CssBaseline />
|
||||
{deviceType === 'desktop' ? (
|
||||
<DesktopLayout
|
||||
groups={groups as any}
|
||||
selectedGroup={selectedGroup as any}
|
||||
selectedTask={selectedTask as any}
|
||||
selectedStep={selectedStep as any}
|
||||
onGroupSelect={setSelectedGroup as any}
|
||||
onTaskSelect={setSelectedTask as any}
|
||||
onStepSelect={setSelectedStep as any}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
{selectedStep ? (
|
||||
<StepDetails
|
||||
step={step!}
|
||||
onPrint={() => handlePrintStep(String(selectedStep.id), '1')} // TODO: Get real user ID
|
||||
onAddNote={(content) => handleAddNote(content, '1')} // TODO: Get real user ID
|
||||
/>
|
||||
) : (
|
||||
<MobileLayout
|
||||
groups={groups as any}
|
||||
selectedGroup={selectedGroup as any}
|
||||
selectedTask={selectedTask as any}
|
||||
selectedStep={selectedStep as any}
|
||||
onGroupSelect={setSelectedGroup as any}
|
||||
onTaskSelect={setSelectedTask as any}
|
||||
onStepSelect={setSelectedStep as any}
|
||||
onBack={handleBack}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</ThemeProvider>
|
||||
)
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ export const PRINT_TASK = gql`
|
||||
mutation PrintTask($id: ID!, $userId: ID!) {
|
||||
printTask(id: $id, userId: $userId) {
|
||||
id
|
||||
print_count
|
||||
last_printed_at
|
||||
printCount
|
||||
lastPrintedAt
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -14,8 +14,8 @@ export const PRINT_STEP = gql`
|
||||
mutation PrintStep($id: ID!, $userId: ID!) {
|
||||
printStep(id: $id, userId: $userId) {
|
||||
id
|
||||
print_count
|
||||
last_printed_at
|
||||
printCount
|
||||
lastPrintedAt
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -25,7 +25,7 @@ export const CREATE_NOTE = gql`
|
||||
createNote(content: $content, stepId: $stepId, userId: $userId) {
|
||||
id
|
||||
content
|
||||
created_at
|
||||
createdAt
|
||||
user {
|
||||
id
|
||||
name
|
||||
|
@ -8,15 +8,15 @@ export const GET_GROUPS = gql`
|
||||
tasks {
|
||||
id
|
||||
name
|
||||
print_count
|
||||
last_printed_at
|
||||
printCount
|
||||
lastPrintedAt
|
||||
steps {
|
||||
id
|
||||
name
|
||||
instructions
|
||||
order
|
||||
print_count
|
||||
last_printed_at
|
||||
printCount
|
||||
lastPrintedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -28,19 +28,19 @@ export const GET_TASKS = gql`
|
||||
tasks(groupId: $groupId) {
|
||||
id
|
||||
name
|
||||
print_count
|
||||
last_printed_at
|
||||
printCount
|
||||
lastPrintedAt
|
||||
steps {
|
||||
id
|
||||
name
|
||||
instructions
|
||||
order
|
||||
print_count
|
||||
last_printed_at
|
||||
printCount
|
||||
lastPrintedAt
|
||||
notes {
|
||||
id
|
||||
content
|
||||
created_at
|
||||
createdAt
|
||||
user {
|
||||
id
|
||||
name
|
||||
@ -58,12 +58,12 @@ export const GET_STEP = gql`
|
||||
name
|
||||
instructions
|
||||
order
|
||||
print_count
|
||||
last_printed_at
|
||||
printCount
|
||||
lastPrintedAt
|
||||
notes {
|
||||
id
|
||||
content
|
||||
created_at
|
||||
createdAt
|
||||
user {
|
||||
id
|
||||
name
|
||||
|
@ -8,33 +8,33 @@ interface GraphQLStep {
|
||||
id: number;
|
||||
name: string;
|
||||
instructions: string;
|
||||
task_id: number;
|
||||
taskId: number;
|
||||
order: number;
|
||||
notes: GraphQLNote[];
|
||||
print_count: number;
|
||||
last_printed_at: string | null;
|
||||
printCount: number;
|
||||
lastPrintedAt: string | null;
|
||||
}
|
||||
|
||||
interface GraphQLNote {
|
||||
id: number;
|
||||
content: string;
|
||||
created_by: number;
|
||||
createdBy: number;
|
||||
user?: {
|
||||
id: number;
|
||||
name: string;
|
||||
created_at: Date;
|
||||
updated_at: Date;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
};
|
||||
}
|
||||
|
||||
interface GraphQLTask {
|
||||
id: number;
|
||||
name: string;
|
||||
group_id: number;
|
||||
groupId: number;
|
||||
steps: GraphQLStep[];
|
||||
notes: GraphQLNote[];
|
||||
print_count: number;
|
||||
last_printed_at: string | null;
|
||||
printCount: number;
|
||||
lastPrintedAt: string | null;
|
||||
}
|
||||
|
||||
interface GraphQLGroup {
|
||||
@ -47,8 +47,8 @@ function toStepWithNotes(step: GraphQLStep): StepWithNotes {
|
||||
return {
|
||||
...step,
|
||||
notes: (step.notes || []).map((note: GraphQLNote) => ({ ...note })),
|
||||
print_count: step.print_count ?? 0,
|
||||
last_printed_at: step.last_printed_at ?? null,
|
||||
printCount: step.printCount ?? 0,
|
||||
lastPrintedAt: step.lastPrintedAt ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
@ -57,8 +57,8 @@ function toTaskWithSteps(task: GraphQLTask): TaskWithSteps {
|
||||
...task,
|
||||
steps: (task.steps || []).map(toStepWithNotes),
|
||||
notes: (task.notes || []),
|
||||
print_count: task.print_count ?? 0,
|
||||
last_printed_at: task.last_printed_at ?? null,
|
||||
printCount: task.printCount ?? 0,
|
||||
lastPrintedAt: task.lastPrintedAt ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,12 @@
|
||||
import { loadErrorMessages, loadDevMessages } from "@apollo/client/dev";
|
||||
import { ApolloProvider } from '@apollo/client';
|
||||
import { client } from './graphql/client';
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
loadDevMessages();
|
||||
loadErrorMessages();
|
||||
}
|
||||
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import { App } from './App';
|
||||
@ -5,6 +14,8 @@ import './index.css'
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
<ApolloProvider client={client}>
|
||||
<App />
|
||||
</ApolloProvider>
|
||||
</React.StrictMode>
|
||||
);
|
||||
|
@ -1,37 +1,37 @@
|
||||
import { Group as SharedGroup, Task as SharedTask, Step as SharedStep, User as SharedUser, Note as SharedNote, PrintHistory as SharedPrintHistory } from '@task-receipts/shared';
|
||||
|
||||
// Client-specific type extensions
|
||||
export interface GroupWithTasks extends Omit<SharedGroup, 'created_at' | 'updated_at'> {
|
||||
export interface GroupWithTasks extends Omit<SharedGroup, 'createdAt' | 'updatedAt'> {
|
||||
tasks: TaskWithSteps[];
|
||||
}
|
||||
|
||||
export interface TaskWithSteps extends Omit<SharedTask, 'created_at' | 'updated_at' | 'last_printed_at'> {
|
||||
export interface TaskWithSteps extends Omit<SharedTask, 'createdAt' | 'updatedAt' | 'lastPrintedAt'> {
|
||||
steps: StepWithNotes[];
|
||||
notes: NoteWithUser[];
|
||||
print_count: number;
|
||||
last_printed_at: string | null;
|
||||
printCount: number;
|
||||
lastPrintedAt: string | null;
|
||||
}
|
||||
|
||||
export interface StepWithNotes extends Omit<SharedStep, 'created_at' | 'updated_at' | 'last_printed_at'> {
|
||||
export interface StepWithNotes extends Omit<SharedStep, 'createdAt' | 'updatedAt' | 'lastPrintedAt'> {
|
||||
notes: NoteWithUser[];
|
||||
print_count: number;
|
||||
last_printed_at: string | null;
|
||||
printCount: number;
|
||||
lastPrintedAt: string | null;
|
||||
}
|
||||
|
||||
export interface NoteWithUser extends Omit<SharedNote, 'created_at' | 'updated_at'> {
|
||||
export interface NoteWithUser extends Omit<SharedNote, 'createdAt' | 'updatedAt'> {
|
||||
user?: SharedUser;
|
||||
}
|
||||
|
||||
export interface PrintHistoryWithDetails extends Omit<SharedPrintHistory, 'created_at' | 'updated_at'> {
|
||||
export interface PrintHistoryWithDetails extends Omit<SharedPrintHistory, 'createdAt' | 'updatedAt'> {
|
||||
user?: SharedUser;
|
||||
task?: TaskWithSteps;
|
||||
step?: StepWithNotes;
|
||||
}
|
||||
|
||||
// Re-export shared types with client-specific modifications
|
||||
export type Group = Omit<SharedGroup, 'created_at' | 'updated_at'>;
|
||||
export type Task = Omit<SharedTask, 'created_at' | 'updated_at' | 'last_printed_at'> & { last_printed_at: string | null };
|
||||
export type Step = Omit<SharedStep, 'created_at' | 'updated_at' | 'last_printed_at'> & { last_printed_at: string | null };
|
||||
export type User = Omit<SharedUser, 'created_at' | 'updated_at'>;
|
||||
export type Note = Omit<SharedNote, 'created_at' | 'updated_at'>;
|
||||
export type PrintHistory = Omit<SharedPrintHistory, 'created_at' | 'updated_at'>;
|
||||
export type Group = Omit<SharedGroup, 'createdAt' | 'updatedAt'>;
|
||||
export type Task = Omit<SharedTask, 'createdAt' | 'updatedAt' | 'lastPrintedAt'> & { lastPrintedAt: string | null };
|
||||
export type Step = Omit<SharedStep, 'createdAt' | 'updatedAt' | 'lastPrintedAt'> & { lastPrintedAt: string | null };
|
||||
export type User = Omit<SharedUser, 'createdAt' | 'updatedAt'>;
|
||||
export type Note = Omit<SharedNote, 'createdAt' | 'updatedAt'>;
|
||||
export type PrintHistory = Omit<SharedPrintHistory, 'createdAt' | 'updatedAt'>;
|
217
package-lock.json
generated
217
package-lock.json
generated
@ -1196,6 +1196,15 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@colors/colors": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz",
|
||||
"integrity": "sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.1.90"
|
||||
}
|
||||
},
|
||||
"node_modules/@cspotcode/source-map-support": {
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
|
||||
@ -1220,6 +1229,17 @@
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@dabh/diagnostics": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz",
|
||||
"integrity": "sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"colorspace": "1.1.x",
|
||||
"enabled": "2.0.x",
|
||||
"kuler": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emotion/babel-plugin": {
|
||||
"version": "11.13.5",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.13.5.tgz",
|
||||
@ -3432,6 +3452,12 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/triple-beam": {
|
||||
"version": "1.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz",
|
||||
"integrity": "sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/yargs": {
|
||||
"version": "17.0.33",
|
||||
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz",
|
||||
@ -3787,7 +3813,6 @@
|
||||
"version": "3.2.6",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz",
|
||||
"integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/async-retry": {
|
||||
@ -4392,6 +4417,16 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/color": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz",
|
||||
"integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"color-convert": "^1.9.3",
|
||||
"color-string": "^1.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
@ -4409,9 +4444,18 @@
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/color-string": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz",
|
||||
"integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"color-name": "^1.0.0",
|
||||
"simple-swizzle": "^0.2.2"
|
||||
}
|
||||
},
|
||||
"node_modules/color-support": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",
|
||||
@ -4422,12 +4466,37 @@
|
||||
"color-support": "bin.js"
|
||||
}
|
||||
},
|
||||
"node_modules/color/node_modules/color-convert": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/color/node_modules/color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/colorette": {
|
||||
"version": "2.0.19",
|
||||
"resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz",
|
||||
"integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/colorspace": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.4.tgz",
|
||||
"integrity": "sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"color": "^3.1.3",
|
||||
"text-hex": "1.0.x"
|
||||
}
|
||||
},
|
||||
"node_modules/combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
@ -4845,6 +4914,12 @@
|
||||
"devOptional": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/enabled": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/enabled/-/enabled-2.0.0.tgz",
|
||||
"integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/encodeurl": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
|
||||
@ -5549,6 +5624,12 @@
|
||||
"bser": "2.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/fecha": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz",
|
||||
"integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/file-entry-cache": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
|
||||
@ -5674,6 +5755,12 @@
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/fn.name": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz",
|
||||
"integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/form-data": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.3.tgz",
|
||||
@ -6469,7 +6556,6 @@
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
|
||||
"integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
@ -7382,6 +7468,12 @@
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/kuler": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz",
|
||||
"integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/leven": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz",
|
||||
@ -7451,6 +7543,29 @@
|
||||
"integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/logform": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/logform/-/logform-2.7.0.tgz",
|
||||
"integrity": "sha512-TFYA4jnP7PVbmlBIfhlSe+WKxs9dklXMTEGcBCIvLhE/Tn3H6Gk1norupVW7m5Cnd4bLcr08AytbyV/xj7f/kQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@colors/colors": "1.6.0",
|
||||
"@types/triple-beam": "^1.3.2",
|
||||
"fecha": "^4.2.0",
|
||||
"ms": "^2.1.1",
|
||||
"safe-stable-stringify": "^2.3.1",
|
||||
"triple-beam": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/logform/node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/loglevel": {
|
||||
"version": "1.9.2",
|
||||
"resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.9.2.tgz",
|
||||
@ -8088,6 +8203,15 @@
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/one-time": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz",
|
||||
"integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fn.name": "1.x.x"
|
||||
}
|
||||
},
|
||||
"node_modules/onetime": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
|
||||
@ -9058,6 +9182,15 @@
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/safe-stable-stringify": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz",
|
||||
"integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
@ -9310,6 +9443,21 @@
|
||||
"simple-concat": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/simple-swizzle": {
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
|
||||
"integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"is-arrayish": "^0.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/simple-swizzle/node_modules/is-arrayish": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
|
||||
"integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/sisteransi": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz",
|
||||
@ -9477,6 +9625,15 @@
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/stack-trace": {
|
||||
"version": "0.0.10",
|
||||
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
|
||||
"integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/stack-utils": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz",
|
||||
@ -9711,6 +9868,12 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/text-hex": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz",
|
||||
"integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/text-table": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
|
||||
@ -9772,6 +9935,15 @@
|
||||
"tree-kill": "cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/triple-beam": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.4.1.tgz",
|
||||
"integrity": "sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ts-invariant": {
|
||||
"version": "0.10.3",
|
||||
"resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.10.3.tgz",
|
||||
@ -10335,6 +10507,42 @@
|
||||
"string-width": "^1.0.2 || 2 || 3 || 4"
|
||||
}
|
||||
},
|
||||
"node_modules/winston": {
|
||||
"version": "3.17.0",
|
||||
"resolved": "https://registry.npmjs.org/winston/-/winston-3.17.0.tgz",
|
||||
"integrity": "sha512-DLiFIXYC5fMPxaRg832S6F5mJYvePtmO5G9v9IgUFPhXm9/GkXarH/TUrBAVzhTCzAj9anE/+GjrgXp/54nOgw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@colors/colors": "^1.6.0",
|
||||
"@dabh/diagnostics": "^2.0.2",
|
||||
"async": "^3.2.3",
|
||||
"is-stream": "^2.0.0",
|
||||
"logform": "^2.7.0",
|
||||
"one-time": "^1.0.0",
|
||||
"readable-stream": "^3.4.0",
|
||||
"safe-stable-stringify": "^2.3.1",
|
||||
"stack-trace": "0.0.x",
|
||||
"triple-beam": "^1.3.0",
|
||||
"winston-transport": "^4.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/winston-transport": {
|
||||
"version": "4.9.0",
|
||||
"resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.9.0.tgz",
|
||||
"integrity": "sha512-8drMJ4rkgaPo1Me4zD/3WLfI/zPdA9o2IipKODunnGDcuqbHwjsbB79ylv04LCGGzU0xQ6vTznOMpQGaLhhm6A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"logform": "^2.7.0",
|
||||
"readable-stream": "^3.6.2",
|
||||
"triple-beam": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/word-wrap": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",
|
||||
@ -10496,7 +10704,8 @@
|
||||
"graphql": "^16.8.1",
|
||||
"knex": "^3.1.0",
|
||||
"pg": "^8.11.3",
|
||||
"sqlite3": "^5.1.7"
|
||||
"sqlite3": "^5.1.7",
|
||||
"winston": "^3.17.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cors": "^2.8.17",
|
||||
|
@ -23,7 +23,8 @@
|
||||
"graphql": "^16.8.1",
|
||||
"knex": "^3.1.0",
|
||||
"pg": "^8.11.3",
|
||||
"sqlite3": "^5.1.7"
|
||||
"sqlite3": "^5.1.7",
|
||||
"winston": "^3.17.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cors": "^2.8.17",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import knex, { Knex } from 'knex';
|
||||
import config from './knexfile.js';
|
||||
import config from './knexfile';
|
||||
import type { Group, Task, Step, Image, User, Note, PrintHistory } from './types.js';
|
||||
|
||||
export function createDb(env: string = process.env.NODE_ENV || 'development') {
|
||||
|
@ -6,7 +6,8 @@ import { typeDefs } from './graphql/schema';
|
||||
import { resolvers } from './graphql/resolvers';
|
||||
import { createDb } from './db';
|
||||
import logger from './logger';
|
||||
import { TestPrinter } from './printer';
|
||||
import { TestPrinter } from './printer/test-printer';
|
||||
import cors from 'cors';
|
||||
|
||||
const app = express();
|
||||
const port = process.env.PORT || 4000;
|
||||
@ -22,6 +23,12 @@ async function startServer() {
|
||||
|
||||
await server.start();
|
||||
|
||||
// Enable CORS for the frontend
|
||||
app.use(cors({
|
||||
origin: 'http://localhost:5173',
|
||||
credentials: true
|
||||
}));
|
||||
|
||||
app.use(json());
|
||||
app.use(
|
||||
'/graphql',
|
||||
|
Loading…
Reference in New Issue
Block a user