@@ -5,16 +5,19 @@ import { schema, type MonComptePro_PgDatabase } from "@~/moncomptepro.database";
5
5
import { and , eq } from "drizzle-orm" ;
6
6
7
7
//
8
+ type UsersOrganizationsColumns =
9
+ keyof typeof schema . users_organizations . _ . columns ;
8
10
9
- export function GetMember ( { pg } : { pg : MonComptePro_PgDatabase } ) {
10
- type UsersOrganizationsColumns =
11
- keyof typeof schema . users_organizations . _ . columns ;
12
- return async function get_member_by_id <
13
- TColumns extends Partial < Record < UsersOrganizationsColumns , true > > ,
14
- > (
15
- { organization_id, user_id } : { organization_id : number ; user_id : number } ,
16
- { columns } : { columns : TColumns } ,
17
- ) {
11
+ export function GetMember <
12
+ TColumns extends Partial < Record < UsersOrganizationsColumns , true > > ,
13
+ > ( { pg, columns } : { pg : MonComptePro_PgDatabase ; columns : TColumns } ) {
14
+ return async function get_member_by_id ( {
15
+ organization_id,
16
+ user_id,
17
+ } : {
18
+ organization_id : number ;
19
+ user_id : number ;
20
+ } ) {
18
21
const member = await pg . query . users_organizations . findFirst ( {
19
22
columns,
20
23
where : and (
@@ -29,4 +32,6 @@ export function GetMember({ pg }: { pg: MonComptePro_PgDatabase }) {
29
32
} ;
30
33
}
31
34
32
- export type GetMemberHandler = ReturnType < typeof GetMember > ;
35
+ export type GetMemberHandler <
36
+ TColumns extends Partial < Record < UsersOrganizationsColumns , true > > ,
37
+ > = ReturnType < typeof GetMember < TColumns > > ;
0 commit comments