21 lines
442 B
TypeScript
21 lines
442 B
TypeScript
import { User } from "../../generated/client";
|
|
|
|
export interface PublicUser {
|
|
firstname: string;
|
|
lastname: string;
|
|
publicId: string;
|
|
badges: string[];
|
|
}
|
|
|
|
export const getPublicUser = (user: User): PublicUser => {
|
|
return {
|
|
firstname: user.firstname,
|
|
lastname: user.lastname
|
|
.split(" ")
|
|
.map((part) => `${part[0]}.`)
|
|
.join(" "), // Only take the first part of the name
|
|
publicId: user.publicId,
|
|
badges: user.badges,
|
|
};
|
|
};
|