| 1 | package CatalystX::OAuth2::Schema::Result::Code; | ||
| 2 | 10 | ▶ | use parent 'DBIx::Class'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | # ABSTRACT: A table for registering grant codes | ||
| 5 | |||
| 6 | 10 | __PACKAGE__->load_components(qw(Core)); | |
| 7 | 10 | __PACKAGE__->table('code'); | |
| 8 | 10 | __PACKAGE__->add_columns( | |
| 9 | client_id => { data_type => 'int', is_nullable => 0 }, | ||
| 10 | id => { data_type => 'int', is_auto_increment => 1, is_nullable => 0 }, | ||
| 11 | is_active => { data_type => 'int', is_nullable => 0, default_value => 0 }, | ||
| 12 | owner_id => { data_type => 'int', is_nullable => 1 } | ||
| 13 | ); | ||
| 14 | 10 | __PACKAGE__->set_primary_key(qw(id)); | |
| 15 | 10 | __PACKAGE__->belongs_to( | |
| 16 | client => 'CatalystX::OAuth2::Schema::Result::Client' => | ||
| 17 | { 'foreign.id' => 'self.client_id' } ); | ||
| 18 | 10 | __PACKAGE__->has_many( tokens => 'CatalystX::OAuth2::Schema::Result::Token' => | |
| 19 | { 'foreign.code_id' => 'self.id' } ); | ||
| 20 | 10 | __PACKAGE__->has_many( | |
| 21 | refresh_tokens => 'CatalystX::OAuth2::Schema::Result::RefreshToken' => | ||
| 22 | { 'foreign.code_id' => 'self.id' } ); | ||
| 23 | 10 | __PACKAGE__->belongs_to( | |
| 24 | owner => 'CatalystX::OAuth2::Schema::Result::Owner', | ||
| 25 | { 'foreign.id' => 'self.owner_id' } | ||
| 26 | ); | ||
| 27 | |||
| 28 | 13 | ▶ | sub as_string { shift->id } |
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 29 | |||
| 30 | sub activate { | ||
| 31 | 2 | ▶ | my($self, $owner_id) = @_; |
|
Subroutine
activate: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 32 | 2 | $self->update( { is_active => 1, owner_id => $owner_id } ) | |
| 33 | } | ||
| 34 | |||
| 35 | 10 | 1; | |
| 36 | |||
| 37 | __END__ | ||
| 38 | |||
| 39 | =pod | ||
| 40 | |||
| 41 | =head1 NAME | ||
| 42 | |||
| 43 | CatalystX::OAuth2::Schema::Result::Code - A table for registering grant codes | ||
| 44 | |||
| 45 | =head1 VERSION | ||
| 46 | |||
| 47 | version 0.001006 | ||
| 48 | |||
| 49 | =head1 AUTHOR | ||
| 50 | |||
| 51 | Eden Cardim <edencardim@gmail.com> | ||
| 52 | |||
| 53 | =head1 COPYRIGHT AND LICENSE | ||
| 54 | |||
| 55 | This software is copyright (c) 2017 by Suretec Systems Ltd. | ||
| 56 | |||
| 57 | This is free software; you can redistribute it and/or modify it under | ||
| 58 | the same terms as the Perl 5 programming language system itself. | ||
| 59 | |||
| 60 | =cut | ||