• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

inclusion-numerique / coop-mediation-numerique / fd0f793a-a8c6-4a69-81c3-56827ded376f

09 Apr 2026 01:22PM UTC coverage: 7.465% (-3.1%) from 10.614%
fd0f793a-a8c6-4a69-81c3-56827ded376f

push

circleci

web-flow
Merge pull request #472 from inclusion-numerique/feat/api-beneficiaires

feat(api): add beneficiaires data to activites API endpoint

500 of 10550 branches covered (4.74%)

Branch coverage included in aggregate %.

0 of 11 new or added lines in 1 file covered. (0.0%)

1379 existing lines in 153 files now uncovered.

1500 of 16241 relevant lines covered (9.24%)

36.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/apps/web/src/features/structures/getStructuresEmployeusesOptions.ts
1
import { prismaClient } from '@app/web/prismaClient'
2

3
export type StructureEmployeuseOption = {
4
  id: string
5
  nom: string
6
  commune: string | null
7
}
8

UNCOV
9
export const getStructuresEmployeusesOptions = async ({
×
10
  mediateurIds,
11
}: {
12
  mediateurIds: string[]
13
}): Promise<StructureEmployeuseOption[]> => {
UNCOV
14
  if (mediateurIds.length === 0) return []
×
15

UNCOV
16
  const structures = await prismaClient.structure.findMany({
×
17
    where: {
18
      emplois: {
19
        some: {
20
          user: {
21
            mediateur: {
22
              id: { in: mediateurIds },
23
            },
24
          },
25
          suppression: null,
26
        },
27
      },
28
    },
29
    select: {
30
      id: true,
31
      nom: true,
32
      commune: true,
33
    },
34
    orderBy: { nom: 'asc' },
35
  })
36

UNCOV
37
  return structures
×
38
}
39

UNCOV
40
export const searchStructuresEmployeuses = async ({
×
41
  query,
42
  mediateurIds,
43
  excludeIds = [],
×
44
}: {
45
  query: string
46
  mediateurIds: string[]
47
  excludeIds?: string[]
48
}): Promise<{ items: StructureEmployeuseOption[] }> => {
49
  if (mediateurIds.length === 0) return { items: [] }
×
50

51
  const searchTerms = query.toLowerCase().trim()
×
52

53
  const structures = await prismaClient.structure.findMany({
×
54
    where: {
55
      AND: [
56
        {
57
          emplois: {
58
            some: {
59
              user: {
60
                mediateur: {
61
                  id: { in: mediateurIds },
62
                },
63
              },
64
              suppression: null,
65
            },
66
          },
67
        },
68
        {
69
          id: { notIn: excludeIds },
70
        },
71
        searchTerms
×
72
          ? {
73
              OR: [
74
                { nom: { contains: searchTerms, mode: 'insensitive' } },
75
                { commune: { contains: searchTerms, mode: 'insensitive' } },
76
              ],
77
            }
78
          : {},
79
      ],
80
    },
81
    select: {
82
      id: true,
83
      nom: true,
84
      commune: true,
85
    },
86
    orderBy: { nom: 'asc' },
87
    take: 20,
88
  })
89

90
  return { items: structures }
×
91
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc