Move database accessors in separate files to separate them from database definitions

This commit is contained in:
pikiou
2022-01-26 22:37:19 +01:00
parent bbe4f9b1d1
commit 110f3505ab
28 changed files with 130 additions and 94 deletions

View File

@@ -0,0 +1,36 @@
import ServiceAccessors from "./accessors"
import {
elementName,
Volunteer,
VolunteerDayWishes,
VolunteerNotifs,
VolunteerParticipationDetails,
VolunteerTeamWishes,
VolunteerWithoutId,
} from "./volunteers"
const serviceAccessors = new ServiceAccessors<VolunteerWithoutId, Volunteer>(elementName)
export const volunteerListGet = serviceAccessors.listGet()
export const volunteerGet = serviceAccessors.get()
export const volunteerAdd = serviceAccessors.add()
export const volunteerSet = serviceAccessors.set()
export const volunteerLogin =
serviceAccessors.customPost<[{ email: string; password: string }]>("Login")
export const volunteerForgot = serviceAccessors.customPost<[{ email: string }]>("Forgot")
export const volunteerNotifsSet =
serviceAccessors.securedCustomPost<[number, Partial<VolunteerNotifs>]>("NotifsSet")
export const volunteerTeamWishesSet =
serviceAccessors.securedCustomPost<[number, Partial<VolunteerTeamWishes>]>("TeamWishesSet")
export const volunteerDayWishesSet =
serviceAccessors.securedCustomPost<[number, Partial<VolunteerDayWishes>]>("DayWishesSet")
export const volunteerParticipationDetailsSet =
serviceAccessors.securedCustomPost<[number, Partial<VolunteerParticipationDetails>]>(
"ParticipationDetailsSet"
)