Files
speckle-server/packages/server/modules/core/helpers/userHelper.ts
T
Kristaps Fabians Geikins 4b06f42db7 chore(server): run TS files directly (no compilation) (#5134)
* sort of works

* type fixes

* added option to run old way too
2025-07-23 11:20:40 +02:00

28 lines
631 B
TypeScript

import type { LimitedUserRecord, UserRecord } from '@/modules/core/helpers/types'
import { pick } from 'lodash-es'
/**
* Fields from the entity that users can see about other users
*/
export const LIMITED_USER_FIELDS: Array<keyof LimitedUserRecord> = [
'id',
'name',
'bio',
'company',
'avatar',
'createdAt',
'verified'
]
/**
* Remove fields from user that other users should not see/know about
*/
export function removePrivateFields(
user: UserRecord | LimitedUserRecord
): LimitedUserRecord {
if (!user) return user
return pick(user, LIMITED_USER_FIELDS)
}
export type { LimitedUserRecord, UserRecord }