-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e95ff1
commit dc21739
Showing
33 changed files
with
587 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\GraphQL\Base\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20240115132144 extends AbstractMigration | ||
{ | ||
public function up(Schema $schema): void | ||
{ | ||
$this->connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); | ||
|
||
if (!$schema->hasTable('oegraphqlrefreshtoken')) { | ||
$this->addSql("CREATE TABLE `oegraphqlrefreshtoken` ( | ||
`OXID` char(32) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL COMMENT 'Primary oxid', | ||
`OXSHOPID` int(11) NOT NULL DEFAULT '0' COMMENT 'Shop id (oxshops), value 0 in case no shop was specified', | ||
`OXUSERID` char(32) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL COMMENT 'Userid for this order', | ||
`TOKEN` char(255) NOT NULL default '' COMMENT 'token string', | ||
`ISSUED_AT` datetime NOT NULL COMMENT 'creation date', | ||
`EXPIRES_AT` datetime NOT NULL COMMENT 'expiration date', | ||
`OXTIMESTAMP` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Timestamp', | ||
PRIMARY KEY (`OXID`), | ||
KEY `OXUSERID` (`OXUSERID`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); | ||
} | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\GraphQL\Base\DataType; | ||
|
||
use TheCodingMachine\GraphQLite\Annotations\Field; | ||
use TheCodingMachine\GraphQLite\Annotations\Type; | ||
|
||
/** | ||
* @Type() | ||
*/ | ||
final class Login | ||
{ | ||
public function __construct( | ||
private string $refreshToken, | ||
private string $accessToken | ||
) { | ||
} | ||
|
||
/** | ||
* @Field() | ||
*/ | ||
public function refreshToken(): string | ||
{ | ||
return $this->refreshToken(); | ||
} | ||
|
||
/** | ||
* @Field() | ||
*/ | ||
public function accessToken(): string | ||
{ | ||
return $this->accessToken(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\GraphQL\Base\DataType; | ||
|
||
use DateTimeInterface; | ||
use OxidEsales\GraphQL\Base\Infrastructure\Model\RefreshToken as GraphQLTokenModel; | ||
use TheCodingMachine\GraphQLite\Annotations\Field; | ||
use TheCodingMachine\GraphQLite\Annotations\Type; | ||
use TheCodingMachine\GraphQLite\Types\ID; | ||
|
||
/** | ||
* @Type() | ||
*/ | ||
final class RefreshToken implements ShopModelAwareInterface | ||
{ | ||
/** @var GraphQLTokenModel */ | ||
private $tokenModel; | ||
|
||
public function __construct(GraphQLTokenModel $tokenModel) | ||
{ | ||
$this->tokenModel = $tokenModel; | ||
} | ||
|
||
public function getEshopModel(): GraphQLTokenModel | ||
{ | ||
return $this->tokenModel; | ||
} | ||
|
||
/** | ||
* @Field() | ||
*/ | ||
public function id(): ID | ||
{ | ||
return new ID((string)$this->tokenModel->getId()); | ||
} | ||
|
||
/** | ||
* @Field() | ||
*/ | ||
public function token(): string | ||
{ | ||
return (string)$this->tokenModel->getRawFieldData('token'); | ||
} | ||
|
||
/** | ||
* @Field() | ||
*/ | ||
public function createdAt(): ?DateTimeInterface | ||
{ | ||
return DateTimeImmutableFactory::fromString( | ||
(string)$this->tokenModel->getRawFieldData('issued_at') | ||
); | ||
} | ||
|
||
/** | ||
* @Field() | ||
*/ | ||
public function expiresAt(): ?DateTimeInterface | ||
{ | ||
return DateTimeImmutableFactory::fromString( | ||
(string)$this->tokenModel->getRawFieldData('expires_at') | ||
); | ||
} | ||
|
||
/** | ||
* @Field() | ||
*/ | ||
public function customerId(): ID | ||
{ | ||
return new ID((string)$this->tokenModel->getRawFieldData('oxuserid')); | ||
} | ||
|
||
/** | ||
* @Field() | ||
*/ | ||
public function shopId(): ID | ||
{ | ||
return new ID((string)$this->tokenModel->getRawFieldData('oxshopid')); | ||
} | ||
|
||
public static function getModelClass(): string | ||
{ | ||
return GraphQLTokenModel::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.