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

inclusion-numerique / coop-mediation-numerique / 63ed3aef-04ec-416c-af7d-d56de15ebe3e

17 Mar 2026 03:48PM UTC coverage: 10.613% (-0.2%) from 10.79%
63ed3aef-04ec-416c-af7d-d56de15ebe3e

Pull #437

circleci

web-flow
Merge pull request #458 from inclusion-numerique/fix/admin-stats-min-date

fix(admin): allow filtering statistics from January 2020
Pull Request #437: release

685 of 10426 branches covered (6.57%)

Branch coverage included in aggregate %.

34 of 590 new or added lines in 86 files covered. (5.76%)

23 existing lines in 20 files now uncovered.

2130 of 16099 relevant lines covered (13.23%)

2.0 hits per line

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

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

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

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

16
  const structures = await prismaClient.structure.findMany({
2✔
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

37
  return structures
2✔
38
}
39

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

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

NEW
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

NEW
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