| @@ 43-115 (lines=73) @@ | ||
| 40 | * |
|
| 41 | * @package OCA\Circles\Db |
|
| 42 | */ |
|
| 43 | class GSEventsRequestBuilder extends CoreRequestBuilder { |
|
| 44 | ||
| 45 | ||
| 46 | /** |
|
| 47 | * Base of the Sql Insert request for Shares |
|
| 48 | * |
|
| 49 | * @return IQueryBuilder |
|
| 50 | */ |
|
| 51 | protected function getGSEventsInsertSql() { |
|
| 52 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 53 | $qb->insert(self::TABLE_GSEVENTS); |
|
| 54 | ||
| 55 | return $qb; |
|
| 56 | } |
|
| 57 | ||
| 58 | ||
| 59 | /** |
|
| 60 | * Base of the Sql Update request for Groups |
|
| 61 | * |
|
| 62 | * @return IQueryBuilder |
|
| 63 | */ |
|
| 64 | protected function getGSEventsUpdateSql() { |
|
| 65 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 66 | $qb->update(self::TABLE_GSEVENTS); |
|
| 67 | ||
| 68 | return $qb; |
|
| 69 | } |
|
| 70 | ||
| 71 | ||
| 72 | /** |
|
| 73 | * @return IQueryBuilder |
|
| 74 | */ |
|
| 75 | protected function getGSEventsSelectSql() { |
|
| 76 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 77 | ||
| 78 | /** @noinspection PhpMethodParametersCountMismatchInspection */ |
|
| 79 | $qb->select('gse.token', 'gse.event', 'gse.instance', 'gse.severity', 'gse.status', 'gse.creation') |
|
| 80 | ->from(self::TABLE_GSEVENTS, 'gse'); |
|
| 81 | ||
| 82 | $this->default_select_alias = 'gse'; |
|
| 83 | ||
| 84 | return $qb; |
|
| 85 | } |
|
| 86 | ||
| 87 | ||
| 88 | /** |
|
| 89 | * Base of the Sql Delete request |
|
| 90 | * |
|
| 91 | * @return IQueryBuilder |
|
| 92 | */ |
|
| 93 | protected function getGSEventsDeleteSql() { |
|
| 94 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 95 | $qb->delete(self::TABLE_GSEVENTS); |
|
| 96 | ||
| 97 | return $qb; |
|
| 98 | } |
|
| 99 | ||
| 100 | ||
| 101 | /** |
|
| 102 | * @param array $data |
|
| 103 | * |
|
| 104 | * @return GSWrapper |
|
| 105 | * @throws JsonException |
|
| 106 | * @throws ModelException |
|
| 107 | */ |
|
| 108 | protected function parseGSEventsSelectSql($data): GSWrapper { |
|
| 109 | $wrapper = new GSWrapper(); |
|
| 110 | $wrapper->import($data); |
|
| 111 | ||
| 112 | return $wrapper; |
|
| 113 | } |
|
| 114 | ||
| 115 | } |
|
| 116 | ||
| @@ 42-118 (lines=77) @@ | ||
| 39 | * |
|
| 40 | * @package OCA\Circles\Db |
|
| 41 | */ |
|
| 42 | class TokensRequestBuilder extends CoreRequestBuilder { |
|
| 43 | ||
| 44 | ||
| 45 | use TArrayTools; |
|
| 46 | ||
| 47 | ||
| 48 | /** |
|
| 49 | * Base of the Sql Insert request for Shares |
|
| 50 | * |
|
| 51 | * @return IQueryBuilder |
|
| 52 | */ |
|
| 53 | protected function getTokensInsertSql() { |
|
| 54 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 55 | $qb->insert(self::TABLE_TOKENS); |
|
| 56 | ||
| 57 | return $qb; |
|
| 58 | } |
|
| 59 | ||
| 60 | ||
| 61 | /** |
|
| 62 | * Base of the Sql Update request for Groups |
|
| 63 | * |
|
| 64 | * @param int $circleId |
|
| 65 | * @param string $groupId |
|
| 66 | * |
|
| 67 | * @return IQueryBuilder |
|
| 68 | */ |
|
| 69 | protected function getTokensUpdateSql($circleId, $groupId) { |
|
| 70 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 71 | $qb->update(self::TABLE_TOKENS); |
|
| 72 | ||
| 73 | return $qb; |
|
| 74 | } |
|
| 75 | ||
| 76 | ||
| 77 | /** |
|
| 78 | * @return IQueryBuilder |
|
| 79 | */ |
|
| 80 | protected function getTokensSelectSql() { |
|
| 81 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 82 | ||
| 83 | /** @noinspection PhpMethodParametersCountMismatchInspection */ |
|
| 84 | $qb->select('t.user_id', 't.circle_id', 't.member_id', 't.share_id', 't.token', 't.accepted') |
|
| 85 | ->from(self::TABLE_TOKENS, 't'); |
|
| 86 | ||
| 87 | $this->default_select_alias = 't'; |
|
| 88 | ||
| 89 | return $qb; |
|
| 90 | } |
|
| 91 | ||
| 92 | ||
| 93 | /** |
|
| 94 | * Base of the Sql Delete request |
|
| 95 | * |
|
| 96 | * @return IQueryBuilder |
|
| 97 | */ |
|
| 98 | protected function getTokensDeleteSql() { |
|
| 99 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 100 | $qb->delete(self::TABLE_TOKENS); |
|
| 101 | ||
| 102 | return $qb; |
|
| 103 | } |
|
| 104 | ||
| 105 | ||
| 106 | /** |
|
| 107 | * @param array $data |
|
| 108 | * |
|
| 109 | * @return SharesToken |
|
| 110 | */ |
|
| 111 | protected function parseTokensSelectSql($data) { |
|
| 112 | $sharesToken = new SharesToken(); |
|
| 113 | $sharesToken->import($data); |
|
| 114 | ||
| 115 | return $sharesToken; |
|
| 116 | } |
|
| 117 | ||
| 118 | } |
|
| 119 | ||