renamed misleading types

This commit is contained in:
Eero Antikainen
2024-09-25 16:13:07 +03:00
parent 10b17328fa
commit f5470a7a3e
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -11,7 +11,7 @@ const getIdsOfUsersProjects = async (user: User) => {
return new Set(usersProjects.map(({ pid }) => pid))
}
type CrossSearchListType = {
type CrossSearchPreFilter = {
lid: number
loc_name: string
bfa_max: string | null
@@ -64,7 +64,7 @@ type CrossSearchListType = {
export const getAllCrossSearch = async (user?: User) => {
const showAll = user && [Role.Admin, Role.EditUnrestricted].includes(user.role)
const removeProjects: (loc: CrossSearchListType) => Omit<CrossSearchListType, 'now_plr'> = loc => {
const removeProjects: (loc: CrossSearchPreFilter) => Omit<CrossSearchPreFilter, 'now_plr'> = loc => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { now_plr, ...rest } = loc
return rest
@@ -178,7 +178,7 @@ export const getAllCrossSearch = async (user?: User) => {
body_mass: item.com_species.body_mass,
brain_mass: item.com_species.brain_mass,
sp_status: item.com_species.sp_status,
})) as CrossSearchListType[]
})) as CrossSearchPreFilter[]
if (showAll) {
const result = flattenedResult.map(removeProjects)
+3 -3
View File
@@ -16,7 +16,7 @@ const getIdsOfUsersProjects = async (user: User) => {
return new Set(usersProjects.map(({ pid }) => pid))
}
type LocalityListType = {
type LocalityPreFilter = {
lid: number
loc_name: string
bfa_max: string | null
@@ -52,7 +52,7 @@ type LocalityListType = {
export const getAllLocalities = async (user?: User) => {
const showAll = user && [Role.Admin, Role.EditUnrestricted].includes(user.role)
const removeProjects: (loc: LocalityListType) => Omit<LocalityListType, 'now_plr'> = loc => {
const removeProjects: (loc: LocalityPreFilter) => Omit<LocalityPreFilter, 'now_plr'> = loc => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { now_plr, ...rest } = loc
return rest
@@ -92,7 +92,7 @@ export const getAllLocalities = async (user?: User) => {
select: { pid: true },
},
},
})) as LocalityListType[]
})) as LocalityPreFilter[]
if (showAll) return result.map(removeProjects)