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

@@ -1,8 +1,9 @@
import { PayloadAction, createSlice, createEntityAdapter } from "@reduxjs/toolkit"
import { StateRequest, toastError, elementListFetch } from "./utils"
import { JavGame, javGameListGet } from "../services/javGames"
import { JavGame } from "../services/javGames"
import { AppThunk, AppState } from "."
import { javGameListGet } from "../services/javGamesAccessors"
const javGameAdapter = createEntityAdapter<JavGame>()

View File

@@ -1,7 +1,8 @@
import { PayloadAction, createSlice, createEntityAdapter } from "@reduxjs/toolkit"
import { StateRequest, elementAddFetch } from "./utils"
import { PreVolunteer, preVolunteerAdd } from "../services/preVolunteers"
import { PreVolunteer } from "../services/preVolunteers"
import { preVolunteerAdd } from "../services/preVolunteersAccessors"
const preVolunteerAdapter = createEntityAdapter<PreVolunteer>()

View File

@@ -1,7 +1,7 @@
import { PayloadAction, createSlice } from "@reduxjs/toolkit"
import { StateRequest, toastError, elementValueFetch } from "./utils"
import { preVolunteerCountGet } from "../services/preVolunteers"
import { preVolunteerCountGet } from "../services/preVolunteersAccessors"
import { AppThunk, AppState } from "."
export const initialState: StateRequest & { value?: number } = { readyStatus: "idle" }

View File

@@ -1,8 +1,9 @@
import { PayloadAction, createSlice, createEntityAdapter, createSelector } from "@reduxjs/toolkit"
import { StateRequest, toastError, elementListFetch } from "./utils"
import { Team, teamListGet } from "../services/teams"
import { Team } from "../services/teams"
import { AppThunk, AppState, EntitiesRequest } from "."
import { teamListGet } from "../services/teamsAccessors"
const teamAdapter = createEntityAdapter<Team>()

View File

@@ -1,8 +1,9 @@
import { PayloadAction, createSlice } from "@reduxjs/toolkit"
import { StateRequest, toastError, elementFetch } from "./utils"
import { Volunteer, volunteerGet } from "../services/volunteers"
import { Volunteer } from "../services/volunteers"
import { AppThunk, AppState } from "."
import { volunteerGet } from "../services/volunteersAccessors"
type StateVolunteer = { entity?: Volunteer } & StateRequest

View File

@@ -1,7 +1,8 @@
import { PayloadAction, createSlice, createEntityAdapter } from "@reduxjs/toolkit"
import { StateRequest, toastError, toastSuccess, elementAddFetch } from "./utils"
import { Volunteer, volunteerAdd } from "../services/volunteers"
import { Volunteer } from "../services/volunteers"
import { volunteerAdd } from "../services/volunteersAccessors"
const volunteerAdapter = createEntityAdapter<Volunteer>()

View File

@@ -1,8 +1,9 @@
import { PayloadAction, createSlice } from "@reduxjs/toolkit"
import { StateRequest, toastError, elementFetch } from "./utils"
import { VolunteerDayWishes, volunteerDayWishesSet } from "../services/volunteers"
import { VolunteerDayWishes } from "../services/volunteers"
import { AppThunk, AppState } from "."
import { volunteerDayWishesSet } from "../services/volunteersAccessors"
type StateVolunteerDayWishesSet = { entity?: VolunteerDayWishes } & StateRequest

View File

@@ -1,7 +1,8 @@
import { PayloadAction, createSlice } from "@reduxjs/toolkit"
import { StateRequest, elementFetch } from "./utils"
import { VolunteerForgot, volunteerForgot } from "../services/volunteers"
import { VolunteerForgot } from "../services/volunteers"
import { volunteerForgot } from "../services/volunteersAccessors"
type StateVolunteer = { entity?: VolunteerForgot } & StateRequest

View File

@@ -1,8 +1,9 @@
import { PayloadAction, createSlice, createEntityAdapter } from "@reduxjs/toolkit"
import { StateRequest, toastError, elementListFetch } from "./utils"
import { Volunteer, volunteerListGet } from "../services/volunteers"
import { Volunteer } from "../services/volunteers"
import { AppThunk, AppState } from "."
import { volunteerListGet } from "../services/volunteersAccessors"
const volunteerAdapter = createEntityAdapter<Volunteer>()

View File

@@ -1,11 +1,12 @@
import { PayloadAction, createSlice } from "@reduxjs/toolkit"
import { StateRequest, elementFetch } from "./utils"
import { VolunteerLogin, volunteerLogin } from "../services/volunteers"
import { VolunteerLogin } from "../services/volunteers"
import { setJWT } from "../services/auth"
import { AppDispatch } from "."
import { setCurrentUser } from "./auth"
import { fetchVolunteerNotifsSet } from "./volunteerNotifsSet"
import { volunteerLogin } from "../services/volunteersAccessors"
type StateVolunteer = { entity?: VolunteerLogin } & StateRequest

View File

@@ -1,8 +1,9 @@
import { PayloadAction, createSlice } from "@reduxjs/toolkit"
import { StateRequest, toastError, elementFetch } from "./utils"
import { VolunteerNotifs, volunteerNotifsSet } from "../services/volunteers"
import { VolunteerNotifs } from "../services/volunteers"
import { AppThunk, AppState } from "."
import { volunteerNotifsSet } from "../services/volunteersAccessors"
type StateVolunteerNotifsSet = { entity?: VolunteerNotifs } & StateRequest

View File

@@ -1,11 +1,9 @@
import { PayloadAction, createSlice } from "@reduxjs/toolkit"
import { StateRequest, toastError, elementFetch } from "./utils"
import {
VolunteerParticipationDetails,
volunteerParticipationDetailsSet,
} from "../services/volunteers"
import { VolunteerParticipationDetails } from "../services/volunteers"
import { AppThunk, AppState } from "."
import { volunteerParticipationDetailsSet } from "../services/volunteersAccessors"
type StateVolunteerParticipationDetailsSet = {
entity?: VolunteerParticipationDetails

View File

@@ -1,7 +1,8 @@
import { PayloadAction, createSlice, createEntityAdapter } from "@reduxjs/toolkit"
import { StateRequest, toastError, toastSuccess, elementSet } from "./utils"
import { Volunteer, volunteerSet } from "../services/volunteers"
import { Volunteer } from "../services/volunteers"
import { volunteerSet } from "../services/volunteersAccessors"
const volunteerAdapter = createEntityAdapter<Volunteer>()

View File

@@ -1,8 +1,9 @@
import { PayloadAction, createSlice } from "@reduxjs/toolkit"
import { StateRequest, toastError, elementFetch } from "./utils"
import { VolunteerTeamWishes, volunteerTeamWishesSet } from "../services/volunteers"
import { VolunteerTeamWishes } from "../services/volunteers"
import { AppThunk, AppState } from "."
import { volunteerTeamWishesSet } from "../services/volunteersAccessors"
type StateVolunteerTeamWishesSet = { entity?: VolunteerTeamWishes } & StateRequest

View File

@@ -1,7 +1,8 @@
import { PayloadAction, createSlice, createEntityAdapter } from "@reduxjs/toolkit"
import { StateRequest, toastError, toastSuccess, elementAddFetch } from "./utils"
import { Wish, wishAdd } from "../services/wishes"
import { Wish } from "../services/wishes"
import { wishAdd } from "../services/wishesAccessors"
const wishAdapter = createEntityAdapter<Wish>()

View File

@@ -1,8 +1,9 @@
import { PayloadAction, createSlice, createEntityAdapter } from "@reduxjs/toolkit"
import { StateRequest, toastError, elementListFetch } from "./utils"
import { Wish, wishListGet } from "../services/wishes"
import { Wish } from "../services/wishes"
import { AppThunk, AppState } from "."
import { wishListGet } from "../services/wishesAccessors"
const wishAdapter = createEntityAdapter<Wish>()