fix(chatbot): changed session id to be unique with user email instead of using testing for everything
This commit is contained in:
parent
4e4fc01ed7
commit
63cc2a4458
|
|
@ -11,9 +11,8 @@ export class ChatbotService {
|
||||||
sessionId: string = 'testing';
|
sessionId: string = 'testing';
|
||||||
|
|
||||||
async pingExternalApi(body: UserMessageDto, email: string): Promise<Message> {
|
async pingExternalApi(body: UserMessageDto, email: string): Promise<Message> {
|
||||||
const { data } = await firstValueFrom(this.httpService.post('https://n8nai.targo.ca/webhook/chatty-Mcbot', { userInput: body.userInput, userId: email, sessionId: this.sessionId }));
|
const { data } = await firstValueFrom(this.httpService.post('https://n8nai.targo.ca/webhook/chatty-Mcbot', { userInput: body.userInput, userId: email, sessionId: email }));
|
||||||
|
|
||||||
console.log(data);
|
|
||||||
return {
|
return {
|
||||||
text: data[0].output,
|
text: data[0].output,
|
||||||
sent: false,
|
sent: false,
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ export class SickLeaveService {
|
||||||
|
|
||||||
takeSickLeaveHours = async (employee_id: number, asked_hours: number): Promise<Result<number, string>> => {
|
takeSickLeaveHours = async (employee_id: number, asked_hours: number): Promise<Result<number, string>> => {
|
||||||
if (asked_hours <= 0) return { success: false, error: 'INVALID_BANKING_HOURS' };
|
if (asked_hours <= 0) return { success: false, error: 'INVALID_BANKING_HOURS' };
|
||||||
console.log('also got here')
|
|
||||||
try {
|
try {
|
||||||
const result = await this.prisma.$transaction(async (tx) => {
|
const result = await this.prisma.$transaction(async (tx) => {
|
||||||
const employee = await this.prisma.employees.findUnique({
|
const employee = await this.prisma.employees.findUnique({
|
||||||
|
|
|
||||||
|
|
@ -10,14 +10,12 @@ export class SchedulePresetDeleteService {
|
||||||
// DELETE
|
// DELETE
|
||||||
//_________________________________________________________________
|
//_________________________________________________________________
|
||||||
async deletePreset(preset_id: number): Promise<Result<boolean, string>> {
|
async deletePreset(preset_id: number): Promise<Result<boolean, string>> {
|
||||||
console.log('preset_id received: ', preset_id)
|
|
||||||
|
|
||||||
const preset = await this.prisma.schedulePresets.findUnique({
|
const preset = await this.prisma.schedulePresets.findUnique({
|
||||||
where: { id: preset_id },
|
where: { id: preset_id },
|
||||||
select: { id: true },
|
select: { id: true },
|
||||||
});
|
});
|
||||||
if (!preset) return { success: false, error: `SCHEDULE_PRESET_NOT_FOUND` };
|
if (!preset) return { success: false, error: `SCHEDULE_PRESET_NOT_FOUND` };
|
||||||
console.log('preset found: ', preset.id)
|
|
||||||
|
|
||||||
const updated_employees = await this.prisma.employees.updateMany({
|
const updated_employees = await this.prisma.employees.updateMany({
|
||||||
where: { schedule_preset_id: preset_id },
|
where: { schedule_preset_id: preset_id },
|
||||||
|
|
@ -25,7 +23,6 @@ export class SchedulePresetDeleteService {
|
||||||
schedule_preset_id: 0,
|
schedule_preset_id: 0,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log('employee schedule id updated', updated_employees);
|
|
||||||
|
|
||||||
await this.prisma.$transaction(async (tx) => {
|
await this.prisma.$transaction(async (tx) => {
|
||||||
await tx.schedulePresetShifts.deleteMany({ where: { preset_id: preset_id } });
|
await tx.schedulePresetShifts.deleteMany({ where: { preset_id: preset_id } });
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ export class GetTimesheetsOverviewService {
|
||||||
|
|
||||||
//loads the timesheets related to the fetched pay-period
|
//loads the timesheets related to the fetched pay-period
|
||||||
let rows = await this.loadTimesheets(employee_id.data, period.period_start, period.period_end);
|
let rows = await this.loadTimesheets(employee_id.data, period.period_start, period.period_end);
|
||||||
console.log(rows);
|
|
||||||
|
|
||||||
//Normalized dates from pay-period strings
|
//Normalized dates from pay-period strings
|
||||||
const normalized_start = toDateFromString(period.period_start);
|
const normalized_start = toDateFromString(period.period_start);
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,6 @@ export const mapOneTimesheet = async (timesheet: Prisma.TimesheetsGetPayload<{
|
||||||
daily_hours[subgroup] += hours;
|
daily_hours[subgroup] += hours;
|
||||||
weekly_hours[subgroup] += hours;
|
weekly_hours[subgroup] += hours;
|
||||||
}
|
}
|
||||||
console.log('date: ', shift.date, ', hours worked: ', hours, ', type: ', subgroup, ', current weekly overtime: ', weekly_hours['overtime']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user