diff --git a/app/api/src/docker/docker-compose.yml b/app/api/src/docker/docker-compose.yml index ea178c2..1682fc9 100644 --- a/app/api/src/docker/docker-compose.yml +++ b/app/api/src/docker/docker-compose.yml @@ -1,16 +1,10 @@ services: - openscad-health: + openscad-preview: build: context: ./ dockerfile: ./openscad/Dockerfile image: openscad - command: openscad.health - ports: - - "5051:8080" - - openscad-preview: - image: openscad command: openscad.preview ports: - "5052:8080" diff --git a/app/api/src/docker/openscad/Dockerfile b/app/api/src/docker/openscad/Dockerfile index 819141a..e5580e3 100644 --- a/app/api/src/docker/openscad/Dockerfile +++ b/app/api/src/docker/openscad/Dockerfile @@ -6,6 +6,7 @@ ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update -qq # double check this below, I'm not sure we need inkscape etc RUN apt-get -y -qq install software-properties-common dirmngr apt-transport-https lsb-release ca-certificates xvfb imagemagick unzip inkscape +RUN add-apt-repository ppa:openscad/releases RUN apt-get update -qq RUN apt-get install -y -qq openscad RUN apt-get install -y curl wget diff --git a/app/api/src/graphql/email.sdl.ts b/app/api/src/graphql/email.sdl.ts index 81ae8fa..64607ef 100644 --- a/app/api/src/graphql/email.sdl.ts +++ b/app/api/src/graphql/email.sdl.ts @@ -7,8 +7,6 @@ export const schema = gql` type EmailResponse { accepted: [String!]! rejected: [String!]! - messageId: String! - envelope: Envelope } input Email { diff --git a/app/api/src/lib/sendmail.ts b/app/api/src/lib/sendmail.ts index a524fdb..aa365fa 100644 --- a/app/api/src/lib/sendmail.ts +++ b/app/api/src/lib/sendmail.ts @@ -1,7 +1,7 @@ import nodemailer, { SendMailOptions } from 'nodemailer' -interface Args { - to: SendMailOptions['to'] +export interface SendMailArgs { + to: string from: SendMailOptions['from'] subject: string text: string @@ -26,7 +26,7 @@ export function sendMail({ from, subject, text, -}: Args): Promise { +}: SendMailArgs): Promise { const transporter = nodemailer.createTransport({ host: 'smtp.mailgun.org', port: 587, diff --git a/app/api/src/services/email/email.ts b/app/api/src/services/email/email.ts index 0d237fb..1463571 100644 --- a/app/api/src/services/email/email.ts +++ b/app/api/src/services/email/email.ts @@ -1,26 +1,45 @@ import { requireAuth } from 'src/lib/auth' import { sendMail } from 'src/lib/sendmail' +import type { SendMailArgs } from 'src/lib/sendmail' import { users } from 'src/services/users/users' export const sendAllUsersEmail = async ({ input: { body, subject } }) => { requireAuth({ role: 'admin' }) - const recipients = (await users()).map(({ email }) => email) const from = { address: 'news@mail.cadhub.xyz', name: 'CadHub', } - const result = await sendMail({ - to: recipients, + const emails: SendMailArgs[] = (await users()).map(({ email }) => ({ + to: email, from, subject, text: body, + })) + const emailPromises = emails.map((email) => sendMail(email)) + const accepted = [] + const rejected = [] + const result = await Promise.allSettled(emailPromises) + result.forEach((result) => { + if (result.status === 'fulfilled') { + accepted.push(result.value.accepted[0]) + } else { + rejected.push(result.reason) + } }) await sendMail({ to: 'k.hutten@protonmail.ch', from, subject: `All users email report`, - text: JSON.stringify(result, null, 2), + text: JSON.stringify( + { + accepted, + rejected, + originalEmailList: emails, + }, + null, + 2 + ), }) - return result + return { accepted, rejected } } diff --git a/app/web/src/components/AdminParts/AdminParts.js b/app/web/src/components/AdminParts/AdminParts.js index 06ea1b8..89a281f 100644 --- a/app/web/src/components/AdminParts/AdminParts.js +++ b/app/web/src/components/AdminParts/AdminParts.js @@ -5,7 +5,7 @@ import { Link, routes } from '@redwoodjs/router' import { QUERY } from 'src/components/AdminPartsCell' const DELETE_PART_MUTATION = gql` - mutation DeletePartMutation($id: String!) { + mutation DeletePartMutationAdmin($id: String!) { deletePart(id: $id) { id } diff --git a/app/web/src/components/AdminPartsCell/AdminPartsCell.js b/app/web/src/components/AdminPartsCell/AdminPartsCell.js index a401087..4b4d55f 100644 --- a/app/web/src/components/AdminPartsCell/AdminPartsCell.js +++ b/app/web/src/components/AdminPartsCell/AdminPartsCell.js @@ -3,7 +3,7 @@ import { Link, routes } from '@redwoodjs/router' import AdminParts from 'src/components/AdminParts' export const QUERY = gql` - query PARTS { + query PARTS_ADMIN { parts { id title diff --git a/app/web/src/components/EditUserCell/EditUserCell.js b/app/web/src/components/EditUserCell/EditUserCell.js index ae328eb..676811e 100644 --- a/app/web/src/components/EditUserCell/EditUserCell.js +++ b/app/web/src/components/EditUserCell/EditUserCell.js @@ -5,7 +5,7 @@ import { navigate, routes } from '@redwoodjs/router' import UserProfile from 'src/components/UserProfile' export const QUERY = gql` - query FIND_USER_BY_ID($userName: String!) { + query FIND_USER_BY_USERNAME($userName: String!) { user: userName(userName: $userName) { id userName diff --git a/app/web/src/components/Footer/Footer.js b/app/web/src/components/Footer/Footer.js index 6fa8697..f20a80c 100644 --- a/app/web/src/components/Footer/Footer.js +++ b/app/web/src/components/Footer/Footer.js @@ -5,6 +5,9 @@ const Footer = () => { return (
+ + Github + Docs diff --git a/app/web/src/components/IdePartCell/IdePartCell.js b/app/web/src/components/IdePartCell/IdePartCell.js index 1b2c7d1..aac04ea 100644 --- a/app/web/src/components/IdePartCell/IdePartCell.js +++ b/app/web/src/components/IdePartCell/IdePartCell.js @@ -24,7 +24,7 @@ export const QUERY = gql` ` const UPDATE_PART_MUTATION = gql` - mutation UpdatePartMutation($id: String!, $input: UpdatePartInput!) { + mutation UpdatePartMutationIde($id: String!, $input: UpdatePartInput!) { updatePart(id: $id, input: $input) { id } diff --git a/app/web/src/components/LandingSection/LandingSection.js b/app/web/src/components/LandingSection/LandingSection.js index 89943e6..2a61f99 100644 --- a/app/web/src/components/LandingSection/LandingSection.js +++ b/app/web/src/components/LandingSection/LandingSection.js @@ -31,9 +31,7 @@ const LandingSection = () => { ode is the future of C AD -
- No more click-n-drool. -
+