server-core-module 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,7 @@ export type TOrder = {
11
11
  name: string;
12
12
  price: number;
13
13
  quantity: number;
14
+ note?: string;
14
15
  }[];
15
16
  totalAmount: number;
16
17
  note?: string;
@@ -16,6 +16,7 @@ exports.schemaOrder = joi_1.default.object({
16
16
  name: joi_1.default.string().required(),
17
17
  price: joi_1.default.number().min(0).required(),
18
18
  quantity: joi_1.default.number().min(1).required(),
19
+ note: joi_1.default.string().optional().allow(''),
19
20
  })).required(),
20
21
  totalAmount: joi_1.default.number().min(0).required(),
21
22
  note: joi_1.default.string().optional(),
@@ -34,6 +35,7 @@ exports.schemaOrderUpdate = joi_1.default.object({
34
35
  name: joi_1.default.string().required(),
35
36
  price: joi_1.default.number().min(0).required(),
36
37
  quantity: joi_1.default.number().min(1).required(),
38
+ note: joi_1.default.string().optional().allow(''),
37
39
  })),
38
40
  totalAmount: joi_1.default.number().min(0),
39
41
  note: joi_1.default.string(),
@@ -10,11 +10,12 @@ async function sendOrderConfirmation(email, name, items, totalAmount, deliveryFe
10
10
  console.log("Sending email to:", email);
11
11
  try {
12
12
  const itemsList = items.map(item => `<tr>
13
- <td>${item.name}</td>
14
- <td>${item.quantity}</td>
15
- <td>₱${item.price}</td>
16
- <td>₱${item.price * item.quantity}</td>
17
- </tr>`).join("");
13
+ <td>${item.name}</td>
14
+ <td>${item.quantity}</td>
15
+ <td>₱${item.price}</td>
16
+ <td>₱${item.price * item.quantity}</td>
17
+ <td>${item.note || '-'}</td>
18
+ </tr>`).join("");
18
19
  resend.emails.send({
19
20
  from: "Cesar's Flower Shop 🌸 <noreply@cesarsflowershop.com>",
20
21
  to: email,
@@ -28,6 +29,7 @@ async function sendOrderConfirmation(email, name, items, totalAmount, deliveryFe
28
29
  <th>Qty</th>
29
30
  <th>Price</th>
30
31
  <th>Subtotal</th>
32
+ <th>Note</th>
31
33
  </tr>
32
34
  ${itemsList}
33
35
  </table>
@@ -66,11 +68,12 @@ async function sendOrderStatusUpdate(email, name, status) {
66
68
  async function sendAdminNotification(name, items, totalAmount, customerEmail, deliveryFee) {
67
69
  try {
68
70
  const itemsList = items.map(item => `<tr>
69
- <td>${item.name}</td>
70
- <td>${item.quantity}</td>
71
- <td>₱${item.price}</td>
72
- <td>₱${item.price * item.quantity}</td>
73
- </tr>`).join("");
71
+ <td>${item.name}</td>
72
+ <td>${item.quantity}</td>
73
+ <td>₱${item.price}</td>
74
+ <td>₱${item.price * item.quantity}</td>
75
+ <td>${item.note || '-'}</td>
76
+ </tr>`).join("");
74
77
  resend.emails.send({
75
78
  from: "Cesar's Flower Shop 🌸 <noreply@cesarsflowershop.com>",
76
79
  to: process.env.ADMIN_EMAIL,
@@ -85,18 +88,19 @@ async function sendAdminNotification(name, items, totalAmount, customerEmail, de
85
88
  <th>Qty</th>
86
89
  <th>Price</th>
87
90
  <th>Subtotal</th>
91
+ <th>Note</th>
88
92
  </tr>
89
93
  ${itemsList}
90
94
  <tr>
91
- <td colspan="3"><strong>Items Subtotal</strong></td>
95
+ <td colspan="4"><strong>Items Subtotal</strong></td>
92
96
  <td>₱${totalAmount - (deliveryFee || 0)}</td>
93
97
  </tr>
94
98
  <tr>
95
- <td colspan="3"><strong>Delivery Fee</strong></td>
99
+ <td colspan="4"><strong>Delivery Fee</strong></td>
96
100
  <td>₱${deliveryFee || 0}</td>
97
101
  </tr>
98
102
  <tr>
99
- <td colspan="3"><strong>Total</strong></td>
103
+ <td colspan="4"><strong>Total</strong></td>
100
104
  <td><strong>₱${totalAmount}</strong></td>
101
105
  </tr>
102
106
  </table>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "server-core-module",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "main": "dist/repositories/product.repository.js",
6
6
  "scripts": {
@@ -12,6 +12,7 @@ export type TOrder = {
12
12
  name: string;
13
13
  price: number;
14
14
  quantity: number;
15
+ note?: string;
15
16
  }[];
16
17
  totalAmount: number;
17
18
  note?: string;
@@ -33,6 +34,7 @@ export const schemaOrder = Joi.object({
33
34
  name: Joi.string().required(),
34
35
  price: Joi.number().min(0).required(),
35
36
  quantity: Joi.number().min(1).required(),
37
+ note: Joi.string().optional().allow(''),
36
38
  })).required(),
37
39
  totalAmount: Joi.number().min(0).required(),
38
40
  note: Joi.string().optional(),
@@ -53,6 +55,7 @@ export const schemaOrderUpdate = Joi.object({
53
55
  name: Joi.string().required(),
54
56
  price: Joi.number().min(0).required(),
55
57
  quantity: Joi.number().min(1).required(),
58
+ note: Joi.string().optional().allow(''),
56
59
  })),
57
60
  totalAmount: Joi.number().min(0),
58
61
  note: Joi.string(),
@@ -6,13 +6,14 @@ export async function sendOrderConfirmation(email: string, name: string, items:
6
6
  try {
7
7
 
8
8
  const itemsList = items.map(item =>
9
- `<tr>
10
- <td>${item.name}</td>
11
- <td>${item.quantity}</td>
12
- <td>₱${item.price}</td>
13
- <td>₱${item.price * item.quantity}</td>
14
- </tr>`
15
- ).join("");
9
+ `<tr>
10
+ <td>${item.name}</td>
11
+ <td>${item.quantity}</td>
12
+ <td>₱${item.price}</td>
13
+ <td>₱${item.price * item.quantity}</td>
14
+ <td>${item.note || '-'}</td>
15
+ </tr>`
16
+ ).join("");
16
17
 
17
18
  resend.emails.send({
18
19
  from: "Cesar's Flower Shop 🌸 <noreply@cesarsflowershop.com>",
@@ -27,6 +28,7 @@ export async function sendOrderConfirmation(email: string, name: string, items:
27
28
  <th>Qty</th>
28
29
  <th>Price</th>
29
30
  <th>Subtotal</th>
31
+ <th>Note</th>
30
32
  </tr>
31
33
  ${itemsList}
32
34
  </table>
@@ -66,14 +68,15 @@ export async function sendOrderStatusUpdate(email: string, name: string, status:
66
68
  export async function sendAdminNotification(name: string, items: any[], totalAmount: number, customerEmail: string, deliveryFee?:number) {
67
69
  try {
68
70
 
69
- const itemsList = items.map(item =>
70
- `<tr>
71
- <td>${item.name}</td>
72
- <td>${item.quantity}</td>
73
- <td>₱${item.price}</td>
74
- <td>₱${item.price * item.quantity}</td>
75
- </tr>`
76
- ).join("");
71
+ const itemsList = items.map(item =>
72
+ `<tr>
73
+ <td>${item.name}</td>
74
+ <td>${item.quantity}</td>
75
+ <td>₱${item.price}</td>
76
+ <td>₱${item.price * item.quantity}</td>
77
+ <td>${item.note || '-'}</td>
78
+ </tr>`
79
+ ).join("");
77
80
 
78
81
  resend.emails.send({
79
82
  from: "Cesar's Flower Shop 🌸 <noreply@cesarsflowershop.com>",
@@ -89,18 +92,19 @@ export async function sendAdminNotification(name: string, items: any[], totalAmo
89
92
  <th>Qty</th>
90
93
  <th>Price</th>
91
94
  <th>Subtotal</th>
95
+ <th>Note</th>
92
96
  </tr>
93
97
  ${itemsList}
94
98
  <tr>
95
- <td colspan="3"><strong>Items Subtotal</strong></td>
99
+ <td colspan="4"><strong>Items Subtotal</strong></td>
96
100
  <td>₱${totalAmount - (deliveryFee || 0)}</td>
97
101
  </tr>
98
102
  <tr>
99
- <td colspan="3"><strong>Delivery Fee</strong></td>
103
+ <td colspan="4"><strong>Delivery Fee</strong></td>
100
104
  <td>₱${deliveryFee || 0}</td>
101
105
  </tr>
102
106
  <tr>
103
- <td colspan="3"><strong>Total</strong></td>
107
+ <td colspan="4"><strong>Total</strong></td>
104
108
  <td><strong>₱${totalAmount}</strong></td>
105
109
  </tr>
106
110
  </table>