.ts
TypeScript
(application/typescript)
// 1st-party
import { ServiceApiContract } from "@ethicdevs/react-monolith";
// 3rd-party
import { FastifyRequest } from "fastify";
// generated via script[generate:prisma]
import { Organization, OrganizationMembership, User } from "@prisma/client";
// app

export interface UsersServiceAPI extends ServiceApiContract {
  getUserById(userId: string): Promise<User | null>;
  getUserByUsername(username: string): Promise<User | null>;
  getUserByEmailAddress(emailAddress: string): Promise<User | null>;
  getUserOrganizationMemberships(
    userId: string
  ): Promise<OrganizationMembership[]>;
  getUserOrganizations(userId: string): Promise<Organization[]>;
}

export interface UsersServiceDeps {
  request: FastifyRequest;
}