blib/lib/Mojolicious/Plugin/Fondation/Auth/Token/Schema/Result/ApiToken.pm

filter: Statementstmt 100% 17 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 20 / 20 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Mojolicious/Plugin/Fondation/Auth/Token/Controller/ApiToken.pm ↑ Summary
1 package Mojolicious::Plugin::Fondation::Auth::Token::Schema::Result::ApiToken;
2 3 $Mojolicious::Plugin::Fondation::Auth::Token::Schema::Result::ApiToken::VERSION = '0.03';
3 # ABSTRACT: DBIx::Class Result class for api_tokens table
4  
5 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶use base 'Mojolicious::Plugin::Fondation::Schema::Result::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 3 __PACKAGE__->load_components(qw/TimeStamp Core/);
11  
12 3 __PACKAGE__->table('api_tokens');
13  
14 3 __PACKAGE__->add_columns(
15 id => {
16 data_type => 'integer',
17 is_auto_increment => 1,
18 is_nullable => 0,
19 extra => { openapi => { readOnly => 1 } },
20 },
21  
22 user_id => {
23 data_type => 'integer',
24 is_nullable => 0,
25 extra => { openapi => { readOnly => 1 } },
26 },
27  
28 token_hash => {
29 data_type => 'text',
30 is_nullable => 0,
31 extra => {
32 openapi => {
33 writeOnly => 1,
34 minLength => 1,
35 create => { required => 0 },
36 },
37 },
38 },
39  
40 name => {
41 data_type => 'varchar',
42 size => 255,
43 is_nullable => 0,
44 extra => { openapi => { minLength => 1, create => { required => 1 } } },
45 },
46  
47 scopes => {
48 data_type => 'text',
49 is_nullable => 1,
50 extra => { openapi => { create => { required => 0 } } },
51 },
52  
53 last_used_at => {
54 data_type => 'datetime',
55 is_nullable => 1,
56 set_on_create => 0,
57 set_on_update => 0,
58 extra => { openapi => { readOnly => 1 } },
59 },
60  
61 created_at => {
62 data_type => 'datetime',
63 is_nullable => 0,
64 set_on_create => 1,
65 set_on_update => 0,
66 extra => { openapi => { readOnly => 1 } },
67 },
68 );
69  
70 3 __PACKAGE__->set_primary_key('id');
71 3 __PACKAGE__->add_unique_constraint(['token_hash']);
72  
73 # ── Relationship: ApiToken belongs to User ────────────────────────────
74 # Auth::Token has a hard dependency on Fondation::User,
75 # so this class is guaranteed to be loaded.
76  
77 3 __PACKAGE__->belongs_to(
78 'user',
79 'Mojolicious::Plugin::Fondation::User::Schema::Result::User',
80 { 'foreign.id' => 'self.user_id' },
81 );
82  
83 3 1;
84  
85 __END__
« lib/Mojolicious/Plugin/Fondation/Auth/Token/Controller/ApiToken.pm ↑ Summary