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

polyphony-chat / sonata / 16250718729

13 Jul 2025 03:34PM UTC coverage: 63.362% (-16.7%) from 80.109%
16250718729

push

github

bitfl0wer
feat(squashme): Further work on register endpoint with TODOs

9 of 20 branches covered (45.0%)

Branch coverage included in aggregate %.

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

28 existing lines in 7 files now uncovered.

285 of 444 relevant lines covered (64.19%)

418.69 hits per line

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

0.0
/src/api/admin/db/mod.rs
1
// This Source Code Form is subject to the terms of the Mozilla Public
2
// License, v. 2.0. If a copy of the MPL was not distributed with this
3
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
4

5
use rand::{Rng, distr::Alphanumeric};
6
use sqlx::{query_as, types::Uuid};
7

8
use crate::database::{Database, Invite};
9

10
/// Create an invite.
UNCOV
11
pub(super) async fn create_invite(
×
UNCOV
12
        owner: Option<&Uuid>,
×
13
        code: Option<&str>,
×
14
        uses_max: i32,
×
15
        db: &Database,
×
16
) -> Result<Invite, crate::errors::SonataDbError> {
×
17
        let code = {
×
18
                if let Some(code) = code {
×
19
                        code
×
20
                } else {
21
                        &rand::rng().sample_iter(&Alphanumeric).take(16).map(char::from).collect::<String>()
×
22
                }
23
        };
UNCOV
24
        Ok(query_as!(
×
25
                Invite,
26
                "INSERT INTO invite_links
27
        (
28
            invite_link_owner,
29
            usages_current, usages_maximum,
30
            invite,
31
            invalid
32
        )
33
        VALUES ($1, 0, $2, $3, $4)
34
        RETURNING
35
            invite_link_owner,
36
            usages_current,
37
            usages_maximum,
38
            invite AS invite_code,
39
            invalid",
40
                owner,
41
                uses_max,
42
                code,
43
                false
44
        )
UNCOV
45
        .fetch_one(&db.pool)
×
UNCOV
46
        .await?)
×
47
}
×
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