332 lines
10 KiB
TypeScript
332 lines
10 KiB
TypeScript
import { Prisma, UserRole } from '@prisma/client';
|
|
import type { RecordVisitInput, BulkRecordVisitInput, StartSessionInput, WalkingRouteInput, ListMyVisitsInput, AdminActivityInput, AdminVisitsInput, VolunteerUpdateLocationInput, OutcomeTrendsQueryInput } from './canvass.schemas';
|
|
export declare const canvassService: {
|
|
getMyAssignments(userId: string): Promise<{
|
|
shiftId: string;
|
|
shiftTitle: string;
|
|
shiftDate: Date;
|
|
startTime: string;
|
|
endTime: string;
|
|
location: string | null;
|
|
cutId: string;
|
|
cutName: string;
|
|
completionPercentage: number;
|
|
}[]>;
|
|
getMyStats(userId: string): Promise<{
|
|
totalVisits: number;
|
|
todayVisits: number;
|
|
byOutcome: Record<string, number>;
|
|
sessions: number;
|
|
}>;
|
|
getMyVisits(userId: string, filters: ListMyVisitsInput): Promise<{
|
|
visits: ({
|
|
address: {
|
|
id: string;
|
|
location: {
|
|
address: string;
|
|
};
|
|
unitNumber: string | null;
|
|
};
|
|
} & {
|
|
id: string;
|
|
durationSeconds: number | null;
|
|
userId: string;
|
|
sessionId: string | null;
|
|
notes: string | null;
|
|
outcome: import(".prisma/client").$Enums.VisitOutcome;
|
|
shiftId: string | null;
|
|
supportLevel: import(".prisma/client").$Enums.SupportLevel | null;
|
|
signRequested: boolean;
|
|
signSize: string | null;
|
|
visitedAt: Date;
|
|
addressId: string;
|
|
})[];
|
|
pagination: {
|
|
page: number;
|
|
limit: number;
|
|
total: number;
|
|
totalPages: number;
|
|
};
|
|
}>;
|
|
getActiveSession(userId: string): Promise<({
|
|
shift: {
|
|
id: string;
|
|
title: string;
|
|
} | null;
|
|
cut: {
|
|
id: string;
|
|
name: string;
|
|
};
|
|
} & {
|
|
status: import(".prisma/client").$Enums.CanvassSessionStatus;
|
|
id: string;
|
|
userId: string;
|
|
cutId: string;
|
|
shiftId: string | null;
|
|
startedAt: Date;
|
|
endedAt: Date | null;
|
|
startLatitude: Prisma.Decimal | null;
|
|
startLongitude: Prisma.Decimal | null;
|
|
}) | null>;
|
|
startSession(userId: string, data: StartSessionInput): Promise<{
|
|
shift: {
|
|
id: string;
|
|
title: string;
|
|
} | null;
|
|
cut: {
|
|
id: string;
|
|
name: string;
|
|
};
|
|
} & {
|
|
status: import(".prisma/client").$Enums.CanvassSessionStatus;
|
|
id: string;
|
|
userId: string;
|
|
cutId: string;
|
|
shiftId: string | null;
|
|
startedAt: Date;
|
|
endedAt: Date | null;
|
|
startLatitude: Prisma.Decimal | null;
|
|
startLongitude: Prisma.Decimal | null;
|
|
}>;
|
|
endSession(sessionId: string, userId: string): Promise<{
|
|
status: import(".prisma/client").$Enums.CanvassSessionStatus;
|
|
id: string;
|
|
userId: string;
|
|
cutId: string;
|
|
shiftId: string | null;
|
|
startedAt: Date;
|
|
endedAt: Date | null;
|
|
startLatitude: Prisma.Decimal | null;
|
|
startLongitude: Prisma.Decimal | null;
|
|
}>;
|
|
getCutLocationsForCanvass(cutId: string, userId: string, bounds?: {
|
|
minLat: number;
|
|
maxLat: number;
|
|
minLng: number;
|
|
maxLng: number;
|
|
}, limit?: number): Promise<{
|
|
location: {
|
|
latitude: number;
|
|
longitude: number;
|
|
id: string;
|
|
address: string;
|
|
buildingNotes: string | null;
|
|
};
|
|
lastVisit: {
|
|
outcome: import(".prisma/client").$Enums.VisitOutcome;
|
|
visitedAt: Date;
|
|
visitorName: string | null;
|
|
isMyVisit: boolean;
|
|
} | null;
|
|
id: string;
|
|
email: string | null;
|
|
phone: string | null;
|
|
notes: string | null;
|
|
firstName: string | null;
|
|
lastName: string | null;
|
|
supportLevel: import(".prisma/client").$Enums.SupportLevel | null;
|
|
unitNumber: string | null;
|
|
sign: boolean;
|
|
signSize: string | null;
|
|
}[]>;
|
|
getAllLocationsForCanvass(userId: string, bounds?: {
|
|
minLat: number;
|
|
maxLat: number;
|
|
minLng: number;
|
|
maxLng: number;
|
|
}, limit?: number): Promise<{
|
|
location: {
|
|
latitude: number;
|
|
longitude: number;
|
|
id: string;
|
|
address: string;
|
|
buildingNotes: string | null;
|
|
};
|
|
lastVisit: {
|
|
outcome: import(".prisma/client").$Enums.VisitOutcome;
|
|
visitedAt: Date;
|
|
visitorName: string | null;
|
|
isMyVisit: boolean;
|
|
} | null;
|
|
id: string;
|
|
email: string | null;
|
|
phone: string | null;
|
|
notes: string | null;
|
|
firstName: string | null;
|
|
lastName: string | null;
|
|
supportLevel: import(".prisma/client").$Enums.SupportLevel | null;
|
|
unitNumber: string | null;
|
|
sign: boolean;
|
|
signSize: string | null;
|
|
}[]>;
|
|
updateAddressAsVolunteer(addressId: string, userId: string, role: UserRole, data: VolunteerUpdateLocationInput): Promise<{
|
|
id: string;
|
|
email: string | null;
|
|
phone: string | null;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
notes: string | null;
|
|
createdByUserId: string | null;
|
|
updatedByUserId: string | null;
|
|
firstName: string | null;
|
|
lastName: string | null;
|
|
supportLevel: import(".prisma/client").$Enums.SupportLevel | null;
|
|
unitNumber: string | null;
|
|
addrGuid: string | null;
|
|
sign: boolean;
|
|
signSize: string | null;
|
|
locationId: string;
|
|
}>;
|
|
getWalkingRoute(cutId: string, userId: string, filters: WalkingRouteInput): Promise<import("./canvass-route.service").RouteResult>;
|
|
recordVisit(userId: string, data: RecordVisitInput): Promise<{
|
|
address: {
|
|
id: string;
|
|
location: {
|
|
address: string;
|
|
};
|
|
unitNumber: string | null;
|
|
};
|
|
} & {
|
|
id: string;
|
|
durationSeconds: number | null;
|
|
userId: string;
|
|
sessionId: string | null;
|
|
notes: string | null;
|
|
outcome: import(".prisma/client").$Enums.VisitOutcome;
|
|
shiftId: string | null;
|
|
supportLevel: import(".prisma/client").$Enums.SupportLevel | null;
|
|
signRequested: boolean;
|
|
signSize: string | null;
|
|
visitedAt: Date;
|
|
addressId: string;
|
|
}>;
|
|
recordBulkVisit(userId: string, data: BulkRecordVisitInput): Promise<{
|
|
created: number;
|
|
visits: {
|
|
id: string;
|
|
durationSeconds: number | null;
|
|
userId: string;
|
|
sessionId: string | null;
|
|
notes: string | null;
|
|
outcome: import(".prisma/client").$Enums.VisitOutcome;
|
|
shiftId: string | null;
|
|
supportLevel: import(".prisma/client").$Enums.SupportLevel | null;
|
|
signRequested: boolean;
|
|
signSize: string | null;
|
|
visitedAt: Date;
|
|
addressId: string;
|
|
}[];
|
|
}>;
|
|
getAdminStats(): Promise<{
|
|
totalVisits: number;
|
|
todayVisits: number;
|
|
activeSessions: number;
|
|
activeVolunteers: number;
|
|
overallCompletion: number;
|
|
}>;
|
|
getCutStats(cutId: string): Promise<{
|
|
cutId: string;
|
|
cutName: string;
|
|
totalLocations: number;
|
|
visitedLocations: number;
|
|
completionPercentage: number;
|
|
totalVisits: number;
|
|
byOutcome: Record<string, number>;
|
|
}>;
|
|
getAdminActivity(filters: AdminActivityInput): Promise<{
|
|
visits: ({
|
|
user: {
|
|
id: string;
|
|
email: string;
|
|
name: string | null;
|
|
};
|
|
address: {
|
|
id: string;
|
|
location: {
|
|
address: string;
|
|
};
|
|
unitNumber: string | null;
|
|
};
|
|
} & {
|
|
id: string;
|
|
durationSeconds: number | null;
|
|
userId: string;
|
|
sessionId: string | null;
|
|
notes: string | null;
|
|
outcome: import(".prisma/client").$Enums.VisitOutcome;
|
|
shiftId: string | null;
|
|
supportLevel: import(".prisma/client").$Enums.SupportLevel | null;
|
|
signRequested: boolean;
|
|
signSize: string | null;
|
|
visitedAt: Date;
|
|
addressId: string;
|
|
})[];
|
|
pagination: {
|
|
page: number;
|
|
limit: number;
|
|
total: number;
|
|
totalPages: number;
|
|
};
|
|
}>;
|
|
getVolunteers(): Promise<{
|
|
userId: string;
|
|
name: string | null;
|
|
email: string;
|
|
totalVisits: number;
|
|
sessions: number;
|
|
lastActive: Date | null;
|
|
}[]>;
|
|
getVolunteerStats(userId: string): Promise<{
|
|
totalVisits: number;
|
|
todayVisits: number;
|
|
byOutcome: Record<string, number>;
|
|
sessions: number;
|
|
}>;
|
|
getAdminVisits(filters: AdminVisitsInput): Promise<{
|
|
visits: ({
|
|
user: {
|
|
id: string;
|
|
email: string;
|
|
name: string | null;
|
|
};
|
|
address: {
|
|
id: string;
|
|
location: {
|
|
address: string;
|
|
};
|
|
unitNumber: string | null;
|
|
};
|
|
} & {
|
|
id: string;
|
|
durationSeconds: number | null;
|
|
userId: string;
|
|
sessionId: string | null;
|
|
notes: string | null;
|
|
outcome: import(".prisma/client").$Enums.VisitOutcome;
|
|
shiftId: string | null;
|
|
supportLevel: import(".prisma/client").$Enums.SupportLevel | null;
|
|
signRequested: boolean;
|
|
signSize: string | null;
|
|
visitedAt: Date;
|
|
addressId: string;
|
|
})[];
|
|
pagination: {
|
|
page: number;
|
|
limit: number;
|
|
total: number;
|
|
totalPages: number;
|
|
};
|
|
}>;
|
|
getOutcomeTrends(filters: OutcomeTrendsQueryInput): Promise<{
|
|
granularity: "week" | "day";
|
|
dateFrom: string;
|
|
dateTo: string;
|
|
series: {
|
|
date: string;
|
|
}[];
|
|
totals: Record<string, number>;
|
|
}>;
|
|
recalculateCutCompletion(cutId: string): Promise<void>;
|
|
closeAbandonedSessions(): Promise<number>;
|
|
};
|
|
//# sourceMappingURL=canvass.service.d.ts.map
|