diff --git a/packages/server/Dockerfile b/packages/server/Dockerfile index 4dd9bf85..82880b77 100644 --- a/packages/server/Dockerfile +++ b/packages/server/Dockerfile @@ -1,5 +1,6 @@ # Stage 0. Copy required files -FROM node:16-alpine as stage0 +# NOTE: Using alpine3.16 because of this issue: https://github.com/prisma/prisma/issues/16553 +FROM node:16-alpine3.16 as stage0 # Set working directory ARG PROJECT_DIR @@ -27,7 +28,7 @@ COPY --chown=node:node scripts/* scripts/ RUN chown -R node:node . # Stage 1. Copy files from stage 0, and install yarn packages -FROM node:16-alpine as stage1 +FROM node:16-alpine3.16 as stage1 # Set working directory ARG PROJECT_DIR @@ -43,7 +44,7 @@ RUN yarn install RUN yarn global add typescript ts-node nodemon prisma@4.0.0 # Stage 2. Copy files from stage 1, and install required unix tools -FROM node:16-alpine as stage2 +FROM node:16-alpine3.16 as stage2 # Set working directory ARG PROJECT_DIR diff --git a/packages/server/src/error.ts b/packages/server/src/error.ts index 2959f312..f24afa62 100644 --- a/packages/server/src/error.ts +++ b/packages/server/src/error.ts @@ -1,5 +1,5 @@ import { ApolloError } from 'apollo-server-express'; -import { genErrorCode, logger, LogLevel } from './logger'; +import { logger, LogLevel } from './logger'; export class CustomError extends ApolloError { constructor(error: any, message?: any, logMeta?: { [key: string]: any }) { @@ -15,7 +15,7 @@ export async function validateArgs(schema: any, args: any) { try { await schema.validate(args, { abortEarly: false }); } catch (err: any) { - console.info('Invalid arguments') + logger.log(LogLevel.info, 'Failed to validate args', args); throw new CustomError({ code: 'ARGS_VALIDATION_FAILED', message: err.errors diff --git a/packages/server/src/schema/customer.ts b/packages/server/src/schema/customer.ts index 624beda3..4ecd0206 100644 --- a/packages/server/src/schema/customer.ts +++ b/packages/server/src/schema/customer.ts @@ -12,6 +12,7 @@ import { IWrap, RecursivePartial } from '../types'; import { Context } from '../context'; import { GraphQLResolveInfo } from 'graphql'; import { AccountStatus, AddCustomerRoleInput, ChangeCustomerStatusInput, Count, Customer, CustomerInput, DeleteCustomerInput, LoginInput, RemoveCustomerRoleInput, RequestPasswordChangeInput, ResetPasswordInput, SignUpInput, UpdateCustomerInput } from './types'; +import { logger, LogLevel } from '../logger'; const LOGIN_ATTEMPTS_TO_SOFT_LOCKOUT = 3; const SOFT_LOCKOUT_DURATION = 15 * 60 * 1000; @@ -152,7 +153,9 @@ export const resolvers = { }, Mutation: { login: async (_parent: undefined, { input }: IWrap, { prisma, req, res }: Context, info: GraphQLResolveInfo): Promise> => { + logger.log(LogLevel.info, 'Logging in user a...', input); const prismaInfo = getCustomerSelect(info); + logger.log(LogLevel.info, 'Logging in user b...'); // If username and password wasn't passed, then use the session cookie data to validate if (!input.email || !input.password) { if (req.customerId && req.roles && req.roles.length > 0) { @@ -164,6 +167,7 @@ export const resolvers = { } res.clearCookie(COOKIE.Jwt); } + logger.log(LogLevel.info, 'Logging in user failed c...'); throw new CustomError(CODE.BadCredentials); } // Validate input format @@ -182,6 +186,7 @@ export const resolvers = { }) // Send new verification email sendResetPasswordLink(input.email, customer.id, requestCode); + logger.log(LogLevel.info, 'Logging in user failed d...'); throw new CustomError(CODE.MustResetPassword); } // Validate verification code, if supplied @@ -205,7 +210,10 @@ export const resolvers = { [AccountStatus.SoftLock]: CODE.SoftLockout, [AccountStatus.HardLock]: CODE.HardLockout } - if (customer.status in status_to_code) throw new CustomError((status_to_code as any)[customer.status]); + if (customer.status in status_to_code) { + logger.log(LogLevel.info, 'Logging in user failed e...', customer.status); + throw new CustomError((status_to_code as any)[customer.status]); + } // Now we can validate the password const validPassword = customer.password && bcrypt.compareSync(input.password, customer.password); if (validPassword) { @@ -224,6 +232,7 @@ export const resolvers = { const cart = await getCart(prisma, info, customer.id); const userData: any = await prisma.customer.findUnique({ where: { id: customer.id }, ...prismaInfo }); if (cart) userData.cart = cart; + logger.log(LogLevel.info, 'Logging in user returning data...', userData); return userData; } else { let new_status = AccountStatus.Unlocked; @@ -237,6 +246,7 @@ export const resolvers = { where: { id: customer.id }, data: { status: new_status, loginAttempts: login_attempts, lastLoginAttempt: new Date().toISOString() } }) + logger.log(LogLevel.info, 'Logging in user failed f...'); throw new CustomError(CODE.BadCredentials); } }, diff --git a/packages/ui/public/android-chrome-192x192.png b/packages/ui/public/android-chrome-192x192.png new file mode 100644 index 00000000..959c15f7 Binary files /dev/null and b/packages/ui/public/android-chrome-192x192.png differ diff --git "a/packages/ui/public/android-chrome-192x192.png\357\200\272Zone.Identifier" "b/packages/ui/public/android-chrome-192x192.png\357\200\272Zone.Identifier" new file mode 100644 index 00000000..b5df949e --- /dev/null +++ "b/packages/ui/public/android-chrome-192x192.png\357\200\272Zone.Identifier" @@ -0,0 +1,3 @@ +[ZoneTransfer] +ZoneId=3 +ReferrerUrl=C:\Users\matth\Downloads\favicon_package_v0.16 (3).zip diff --git a/packages/ui/public/android-chrome-512x512.png b/packages/ui/public/android-chrome-512x512.png new file mode 100644 index 00000000..d0a69fc8 Binary files /dev/null and b/packages/ui/public/android-chrome-512x512.png differ diff --git "a/packages/ui/public/android-chrome-512x512.png\357\200\272Zone.Identifier" "b/packages/ui/public/android-chrome-512x512.png\357\200\272Zone.Identifier" new file mode 100644 index 00000000..b5df949e --- /dev/null +++ "b/packages/ui/public/android-chrome-512x512.png\357\200\272Zone.Identifier" @@ -0,0 +1,3 @@ +[ZoneTransfer] +ZoneId=3 +ReferrerUrl=C:\Users\matth\Downloads\favicon_package_v0.16 (3).zip diff --git a/packages/ui/public/apple-touch-icon.png b/packages/ui/public/apple-touch-icon.png index b455a34e..caf91d77 100644 Binary files a/packages/ui/public/apple-touch-icon.png and b/packages/ui/public/apple-touch-icon.png differ diff --git "a/packages/ui/public/apple-touch-icon.png\357\200\272Zone.Identifier" "b/packages/ui/public/apple-touch-icon.png\357\200\272Zone.Identifier" new file mode 100644 index 00000000..b5df949e --- /dev/null +++ "b/packages/ui/public/apple-touch-icon.png\357\200\272Zone.Identifier" @@ -0,0 +1,3 @@ +[ZoneTransfer] +ZoneId=3 +ReferrerUrl=C:\Users\matth\Downloads\favicon_package_v0.16 (3).zip diff --git a/packages/ui/public/browserconfig.xml b/packages/ui/public/browserconfig.xml new file mode 100644 index 00000000..b3930d0f --- /dev/null +++ b/packages/ui/public/browserconfig.xml @@ -0,0 +1,9 @@ + + + + + + #da532c + + + diff --git "a/packages/ui/public/browserconfig.xml\357\200\272Zone.Identifier" "b/packages/ui/public/browserconfig.xml\357\200\272Zone.Identifier" new file mode 100644 index 00000000..b5df949e --- /dev/null +++ "b/packages/ui/public/browserconfig.xml\357\200\272Zone.Identifier" @@ -0,0 +1,3 @@ +[ZoneTransfer] +ZoneId=3 +ReferrerUrl=C:\Users\matth\Downloads\favicon_package_v0.16 (3).zip diff --git a/packages/ui/public/favicon-16x16.png b/packages/ui/public/favicon-16x16.png new file mode 100644 index 00000000..a86fd52c Binary files /dev/null and b/packages/ui/public/favicon-16x16.png differ diff --git "a/packages/ui/public/favicon-16x16.png\357\200\272Zone.Identifier" "b/packages/ui/public/favicon-16x16.png\357\200\272Zone.Identifier" new file mode 100644 index 00000000..b5df949e --- /dev/null +++ "b/packages/ui/public/favicon-16x16.png\357\200\272Zone.Identifier" @@ -0,0 +1,3 @@ +[ZoneTransfer] +ZoneId=3 +ReferrerUrl=C:\Users\matth\Downloads\favicon_package_v0.16 (3).zip diff --git a/packages/ui/public/favicon-32x32.png b/packages/ui/public/favicon-32x32.png new file mode 100644 index 00000000..97615c13 Binary files /dev/null and b/packages/ui/public/favicon-32x32.png differ diff --git "a/packages/ui/public/favicon-32x32.png\357\200\272Zone.Identifier" "b/packages/ui/public/favicon-32x32.png\357\200\272Zone.Identifier" new file mode 100644 index 00000000..b5df949e --- /dev/null +++ "b/packages/ui/public/favicon-32x32.png\357\200\272Zone.Identifier" @@ -0,0 +1,3 @@ +[ZoneTransfer] +ZoneId=3 +ReferrerUrl=C:\Users\matth\Downloads\favicon_package_v0.16 (3).zip diff --git a/packages/ui/public/favicon-android.png b/packages/ui/public/favicon-android.png deleted file mode 100644 index 7b925c1f..00000000 Binary files a/packages/ui/public/favicon-android.png and /dev/null differ diff --git "a/packages/ui/public/favicon-android.png\357\200\272Zone.Identifier" "b/packages/ui/public/favicon-android.png\357\200\272Zone.Identifier" deleted file mode 100644 index f0e55c72..00000000 --- "a/packages/ui/public/favicon-android.png\357\200\272Zone.Identifier" +++ /dev/null @@ -1,4 +0,0 @@ -[ZoneTransfer] -ZoneId=3 -ReferrerUrl=https://tinypng.com/ -HostUrl=https://tinypng.com/web/output/fgba8hy9mpe0wbrnygm2q6mt48f0vtk3/favicon-android.png diff --git a/packages/ui/public/favicon-android.xcf b/packages/ui/public/favicon-android.xcf deleted file mode 100644 index e9121985..00000000 Binary files a/packages/ui/public/favicon-android.xcf and /dev/null differ diff --git a/packages/ui/public/favicon.ico b/packages/ui/public/favicon.ico new file mode 100644 index 00000000..4263b472 Binary files /dev/null and b/packages/ui/public/favicon.ico differ diff --git "a/packages/ui/public/favicon.ico\357\200\272Zone.Identifier" "b/packages/ui/public/favicon.ico\357\200\272Zone.Identifier" new file mode 100644 index 00000000..b5df949e --- /dev/null +++ "b/packages/ui/public/favicon.ico\357\200\272Zone.Identifier" @@ -0,0 +1,3 @@ +[ZoneTransfer] +ZoneId=3 +ReferrerUrl=C:\Users\matth\Downloads\favicon_package_v0.16 (3).zip diff --git a/packages/ui/public/favicon.xcf b/packages/ui/public/favicon.xcf deleted file mode 100644 index 97a59a22..00000000 Binary files a/packages/ui/public/favicon.xcf and /dev/null differ diff --git a/packages/ui/public/index.html b/packages/ui/public/index.html index 896fb6a8..ce3314d6 100644 --- a/packages/ui/public/index.html +++ b/packages/ui/public/index.html @@ -5,16 +5,29 @@ - + New Life Nursery - - - - - - - New Life Nursery + + + + + + + + + + + + + + + + + + + @@ -24,7 +37,8 @@ - + diff --git a/packages/ui/public/mstile-150x150.png b/packages/ui/public/mstile-150x150.png new file mode 100644 index 00000000..4bb5dd0e Binary files /dev/null and b/packages/ui/public/mstile-150x150.png differ diff --git "a/packages/ui/public/mstile-150x150.png\357\200\272Zone.Identifier" "b/packages/ui/public/mstile-150x150.png\357\200\272Zone.Identifier" new file mode 100644 index 00000000..b5df949e --- /dev/null +++ "b/packages/ui/public/mstile-150x150.png\357\200\272Zone.Identifier" @@ -0,0 +1,3 @@ +[ZoneTransfer] +ZoneId=3 +ReferrerUrl=C:\Users\matth\Downloads\favicon_package_v0.16 (3).zip diff --git a/packages/ui/public/safari-pinned-tab.svg b/packages/ui/public/safari-pinned-tab.svg new file mode 100644 index 00000000..6cb94800 --- /dev/null +++ b/packages/ui/public/safari-pinned-tab.svg @@ -0,0 +1,197 @@ + + + + +Created by potrace 1.14, written by Peter Selinger 2001-2017 + + + + + diff --git "a/packages/ui/public/safari-pinned-tab.svg\357\200\272Zone.Identifier" "b/packages/ui/public/safari-pinned-tab.svg\357\200\272Zone.Identifier" new file mode 100644 index 00000000..b5df949e --- /dev/null +++ "b/packages/ui/public/safari-pinned-tab.svg\357\200\272Zone.Identifier" @@ -0,0 +1,3 @@ +[ZoneTransfer] +ZoneId=3 +ReferrerUrl=C:\Users\matth\Downloads\favicon_package_v0.16 (3).zip diff --git a/packages/ui/public/site.webmanifest b/packages/ui/public/site.webmanifest new file mode 100644 index 00000000..0b172b13 --- /dev/null +++ b/packages/ui/public/site.webmanifest @@ -0,0 +1,20 @@ +{ + "name": "New Life Nursery", + "short_name": "New Life Nursery", + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#1b5e20", + "background_color": "#1b5e20", + "start_url": "https://newlifenurseryinc.com", + "display": "standalone" +} diff --git "a/packages/ui/public/site.webmanifest\357\200\272Zone.Identifier" "b/packages/ui/public/site.webmanifest\357\200\272Zone.Identifier" new file mode 100644 index 00000000..b5df949e --- /dev/null +++ "b/packages/ui/public/site.webmanifest\357\200\272Zone.Identifier" @@ -0,0 +1,3 @@ +[ZoneTransfer] +ZoneId=3 +ReferrerUrl=C:\Users\matth\Downloads\favicon_package_v0.16 (3).zip