-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
checkPurchaseOrderStatus y correo de compra completada en 9punto5 #269
base: main
Are you sure you want to change the base?
Conversation
@@ -35,6 +35,9 @@ const isOwnerOfPurchaseOrder = async ({ | |||
const isOwner = await DB.query.purchaseOrdersSchema.findFirst({ | |||
where: (po, { eq, and }) => | |||
and(eq(po.id, purchaseOrderId), eq(po.userId, user.id)), | |||
columns: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Es esto necesario si estamos devolviendo un Boolean(isOwner)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En este caso la tabla no tiene muchas columnas ni hacemos joins pero creo creo que seleccionar solo las columnas necesarias es una buena práctica.
¿Es necesario? No
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤘🏼 me parece overkill, pero no estoy en contra
email, | ||
}: { | ||
DB: ORM_TYPE; | ||
type SendPurchaseOrderSuccessfulEmailArgs = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
porque este cambio? la idea inicial es no tener que obtener toda la data de cada purchase order previamente cuando quieras usar este metodo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creo que hay optimizar la aplicación para evitar hacer consultas repetidas.
- Esta función era utilizada en createPaymentIntent si todos los tickets son gratis.
- En createPaymentIntent se está utilizando la función "fetchPurchaseOrderInformation" que ya traía la información de los ticketTemplate, prices y currencies.
- En esta función se estaba repitiendo la misma consulta.
Por eso en principio había hecho este cambio, para evitar consultas duplicadas a la BD.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sacar la informacion de la BDD tiene q ser... 150ms? al ojo? Por ahora, no buscaría optimizar llamadas o performance (aka, evitar hacer consultas, etc) sino, hacer la experiencia de desarrollo mas facil por ahora.
Si esta, dale dejemoslo, pero 300ms no van a causar un drop de uso.
@@ -419,14 +413,6 @@ export const createPaymentIntent = async ({ | |||
|
|||
const userTicketsIds = userTickets.map((t) => t.id); | |||
|
|||
await sendConfirmationEmail({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Si todos los tickets son gratis, esto debería generar una PO "lista"....
Estamos validando y enviando un correo en este caso en otro lado?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tienes razón, mala mia. Pasé por alto el "if (allTicketsAreFree)"
Me fijaré los tests de esto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¿En que casos, uno le pasaría generatePaymentLink como null a la mutación "claimUserTicket"?
El caso que se me ocurre es cuando todos los tickets son gratuitos.
Si se le pasa "generatePaymentLink" como null, entonces "createPaymentIntent" nunca es llamado y el correo no va a ser enviado.
gql_api/src/schema/userTickets/mutations.ts
Line 257 in 7fd1471
builder.mutationField("claimUserTicket", (t) => |
@@ -237,27 +237,200 @@ export const PoppinsFont = () => ( | |||
</> | |||
); | |||
|
|||
const roboto = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tengo 2 preguntas:
- Son necesarias todas estás fuentes? Quizás solo incluir las que necesitas
- Esto descarga todas las fuentes así no las use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esto descarga todas las fuentes así no las use?
Si estan en el HTML final, deberian
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seguí el estilo de lo mismo que se está haciendo con poppins
, en la Poppins se está haciendo lo mismo de cargar un montón de fuentes.
Entiendo que sí una font-face no es utilizada no se descarga:
Igual estuve averiguando y vi que Gmail no soporta custom web fonts:
- https://stackoverflow.com/a/70455614
- https://www.caniemail.com/features/css-at-font-face/
- https://react.email/docs/components/font
Lo recomendable es usar web fonts que están disponibles en la mayoría de clientes de correo.
Hice unos tests en Gmail y efectivamente, no vi que se estuvieran haciendo peticiones a estas URLs definidas aquí por lo que tal vez ni si quiera vale mucho la pena tener custom fonts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¿Me fijo que se usa y solo hago la carga de eso?
¿Hago lo mismo para Poppins?
</> | ||
); | ||
|
||
const bebasNeue = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Se agrego nueva fuente
@@ -40,14 +43,16 @@ const sendEmailFunction = async ( | |||
logger.info("Using batch send"); | |||
const resendArgsArray = resendArgs.map((args) => { | |||
const { from, htmlContent, subject, to, tags } = args; | |||
|
|||
return { | |||
const next: CreateEmailOptions = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Se tipó este mapeo para asegurar que todo está correcto con lo que espera resend
{ | ||
name: purchaseOrder.user.name ?? purchaseOrder.user.username, | ||
email: purchaseOrder.user.email, | ||
if (communityInfo.name === "9punto5") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Este if no me convence pero creo que es lo que hay por ahora
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
subject: "Tus tickets están listos 🎉 | 9punto5", | ||
}); | ||
} else { | ||
await sendTransactionalHTMLEmail(this.resend, this.logger, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Entiendo que este correo no está terminado aún ¿tal vez directamente sacar esto por ahora y sumarlo en otro PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Es necesario twekear el estilo, mejor dejarlo si no necesitamos borarlo
email, | ||
}: { | ||
DB: ORM_TYPE; | ||
type SendPurchaseOrderSuccessfulEmailArgs = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creo que hay optimizar la aplicación para evitar hacer consultas repetidas.
- Esta función era utilizada en createPaymentIntent si todos los tickets son gratis.
- En createPaymentIntent se está utilizando la función "fetchPurchaseOrderInformation" que ya traía la información de los ticketTemplate, prices y currencies.
- En esta función se estaba repitiendo la misma consulta.
Por eso en principio había hecho este cambio, para evitar consultas duplicadas a la BD.
@@ -237,27 +237,200 @@ export const PoppinsFont = () => ( | |||
</> | |||
); | |||
|
|||
const roboto = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seguí el estilo de lo mismo que se está haciendo con poppins
, en la Poppins se está haciendo lo mismo de cargar un montón de fuentes.
Entiendo que sí una font-face no es utilizada no se descarga:
Igual estuve averiguando y vi que Gmail no soporta custom web fonts:
- https://stackoverflow.com/a/70455614
- https://www.caniemail.com/features/css-at-font-face/
- https://react.email/docs/components/font
Lo recomendable es usar web fonts que están disponibles en la mayoría de clientes de correo.
Hice unos tests en Gmail y efectivamente, no vi que se estuvieran haciendo peticiones a estas URLs definidas aquí por lo que tal vez ni si quiera vale mucho la pena tener custom fonts.
@@ -35,6 +35,9 @@ const isOwnerOfPurchaseOrder = async ({ | |||
const isOwner = await DB.query.purchaseOrdersSchema.findFirst({ | |||
where: (po, { eq, and }) => | |||
and(eq(po.id, purchaseOrderId), eq(po.userId, user.id)), | |||
columns: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤘🏼 me parece overkill, pero no estoy en contra
subject: "Tus tickets están listos 🎉 | 9punto5", | ||
}); | ||
} else { | ||
await sendTransactionalHTMLEmail(this.resend, this.logger, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Es necesario twekear el estilo, mejor dejarlo si no necesitamos borarlo
{ | ||
name: purchaseOrder.user.name ?? purchaseOrder.user.username, | ||
email: purchaseOrder.user.email, | ||
if (communityInfo.name === "9punto5") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
email, | ||
}: { | ||
DB: ORM_TYPE; | ||
type SendPurchaseOrderSuccessfulEmailArgs = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sacar la informacion de la BDD tiene q ser... 150ms? al ojo? Por ahora, no buscaría optimizar llamadas o performance (aka, evitar hacer consultas, etc) sino, hacer la experiencia de desarrollo mas facil por ahora.
Si esta, dale dejemoslo, pero 300ms no van a causar un drop de uso.
Este PR implementa el envío de correos electrónicos de confirmación de compra específicos para tickets de 9punto5.
Los cambios principales incluyen:
PurchaseOrderSuccessful9punto5
para 9punto5.