| 1 | package Daje::Helper::Companies::Load; | ||
| 2 | use Mojo::Base -base, -async_await; | ||
| 3 | use v5.42; | ||
| 4 | |||
| 5 | # NAME | ||
| 6 | # ==== | ||
| 7 | # | ||
| 8 | # Daje::Helper::Companies::Load - Its a company helper | ||
| 9 | # | ||
| 10 | # | ||
| 11 | # DESCRIPTION | ||
| 12 | # =========== | ||
| 13 | # | ||
| 14 | # | ||
| 15 | # | ||
| 16 | # REQUIRES | ||
| 17 | # ======== | ||
| 18 | # | ||
| 19 | # | ||
| 20 | # v5.42 | ||
| 21 | # | ||
| 22 | # Mojo::Base | ||
| 23 | # | ||
| 24 | # | ||
| 25 | # METHODS | ||
| 26 | # ======= | ||
| 27 | # | ||
| 28 | # | ||
| 29 | # LICENSE | ||
| 30 | # ======= | ||
| 31 | # | ||
| 32 | # Copyright (C) janeskil1525. | ||
| 33 | # | ||
| 34 | # This library is free software; you can redistribute it and/or modify | ||
| 35 | # it under the same terms as Perl itself. | ||
| 36 | # | ||
| 37 | # AUTHOR | ||
| 38 | # ====== | ||
| 39 | # | ||
| 40 | # janeskil1525 E<lt>janeskil1525@gmail.comE<gt> | ||
| 41 | # | ||
| 42 | |||
| 43 | has 'db'; | ||
| 44 | |||
| 45 | async sub load_companies_from_user_mail_p($self, $mail){ | ||
| 46 | my $stmt = qq { | ||
| 47 | SELECT companies_companies.* FROM companies_companies, companies_users | ||
| 48 | WHERE companies_companies_pkey = companies_companies_fkey | ||
| 49 | AND users_users_fkey = (SELECT users_users_pkey FROM users_users WHERE mail = ?) | ||
| 50 | }; | ||
| 51 | |||
| 52 | my $hash = $self->db->query( | ||
| 53 | $stmt,($mail) | ||
| 54 | ); | ||
| 55 | |||
| 56 | my $result = []; | ||
| 57 | $result = $hash->hashes if $hash && $hash->rows > 0; | ||
| 58 | |||
| 59 | return $result; | ||
| 60 | } | ||
| 61 | 1; |