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

polyphony-chat / sonata / 16330481794

16 Jul 2025 09:14PM UTC coverage: 83.522% (+1.2%) from 82.316%
16330481794

push

github

bitfl0wer
feat: use strum for Display/FromStr derive, over derive_more

17 of 50 branches covered (34.0%)

Branch coverage included in aggregate %.

3 of 4 new or added lines in 1 file covered. (75.0%)

31 existing lines in 2 files now uncovered.

500 of 569 relevant lines covered (87.87%)

327.89 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::{
9
        database::{Database, Invite},
10
        errors::Error,
11
};
12

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