tweak email template model, fix EventLog content size, etc...
This commit is contained in:
@ -279,8 +279,8 @@ export default async function handler(req, res) {
|
||||
let pubsToSend = subscribedPublishers.concat(availablePublishers).
|
||||
filter((item, index, self) =>
|
||||
index === self.findIndex((t) => (
|
||||
t.email === item.email //and exclude the user himself
|
||||
)) //&& item.email !== publisher.email
|
||||
t.email === item.email && item.email !== publisher.email//and exclude the user himself
|
||||
))
|
||||
);
|
||||
console.log("Sending CoverMe request to " + pubsToSend.length + " publishers");
|
||||
|
||||
@ -294,17 +294,18 @@ export default async function handler(req, res) {
|
||||
+ "до: " + pubsToSend.map(p => p.firstName + " " + p.lastName + "<" + p.email + ">").join(", "),
|
||||
}
|
||||
});
|
||||
|
||||
//send email to all subscribed publishers
|
||||
for (let i = 0; i < pubsToSend.length; i++) {
|
||||
|
||||
//send email to subscribed publisher
|
||||
let acceptUrl = process.env.NEXTAUTH_URL + "/api/email?action=email_response&emailaction=coverMeAccept&userId=" + pubsToSend[i].id + "&shiftId=" + assignment.shiftId + "&assignmentPID=" + newPublicGuid;
|
||||
publisher.prefix = publisher.isMale ? "Брат" : "Сестра";
|
||||
|
||||
let model = {
|
||||
user: publisher,
|
||||
shiftId: assignment.shiftId,
|
||||
acceptUrl: acceptUrl,
|
||||
prefix: publisher.isMale ? "Брат" : "Сестра",
|
||||
firstName: pubsToSend[i].firstName,
|
||||
lastName: pubsToSend[i].lastName,
|
||||
email: pubsToSend[i].email,
|
||||
|
@ -205,7 +205,7 @@ export const getServerSideProps = async (context) => {
|
||||
},
|
||||
});
|
||||
|
||||
const assignments = publisher?.assignments || [];
|
||||
const assignments = publisher?.assignments.filter(assignment => assignment.shift.startTime >= lastSunday) || [];
|
||||
|
||||
const transformedAssignments = assignments?.map(assignment => {
|
||||
if (assignment.shift && assignment.shift.startTime) {
|
||||
|
@ -4,7 +4,7 @@ CREATE TABLE `EventLog` (
|
||||
`date` DATETIME(3) NOT NULL,
|
||||
`publisherId` VARCHAR(191) NULL,
|
||||
`shiftId` INTEGER NULL,
|
||||
`content` VARCHAR(191) NOT NULL,
|
||||
`content` VARCHAR(5000) NOT NULL,
|
||||
`type` ENUM('AssignmentReplacementRequested', 'AssignmentReplacementAccepted', 'SentEmail') NOT NULL,
|
||||
|
||||
|
||||
|
@ -271,7 +271,7 @@ model EventLog {
|
||||
publisher Publisher? @relation(fields: [publisherId], references: [id])
|
||||
shiftId Int?
|
||||
shift Shift? @relation(fields: [shiftId], references: [id])
|
||||
content String
|
||||
content String @db.VarChar(5000)
|
||||
type EventLogType
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
{{!-- за смяна на {{placeName}} за {{dateStr}}! --}}
|
||||
</h3>
|
||||
<p>Здравей {{firstName}},</p>
|
||||
<p>{{prefix}} {{user.firstName}} {{user.lastName}} търси заместник.</p>
|
||||
<p>{{user.prefix}} {{user.firstName}} {{user.lastName}} търси заместник.</p>
|
||||
{{!-- <p><strong>Shift Details:</strong></p> --}}
|
||||
<p>Дата: {{dateStr}} <br>Час: {{time}}<br>Място: {{placeName}}</p>
|
||||
<p>С натискането на бутона по-долу можеш да премеш да го заместваш.
|
||||
|
Reference in New Issue
Block a user