Skip to content

Commit

Permalink
Merge pull request #38 from lsst-epo/EPO-7944
Browse files Browse the repository at this point in the history
Epo 7944
  • Loading branch information
ericdrosas87 authored Apr 20, 2023
2 parents cfda639 + 43cb1e1 commit 2646ffa
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 13 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4] - 04-12-2023

### Changed

- Namespace change from rosas -> lsst

### Fixed

- Tech debt clean-up:
- PhpStorm-isms for method/class annotations
- Miscellaneous tech debt clean-up
- Changed return type of exception logic in Assets service to string
- Changed logging to Craft::warn() for stdout
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "craft-plugin",
"keywords": ["dam", "digital", "asset", "manager"],
"license": "MIT",
"version": "v0.3.1-alpha",
"version": "v0.4",
"authors": [
{
"name": "Eric Rosas",
Expand Down
1 change: 1 addition & 0 deletions src/DamPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class DamPlugin extends Plugin
public static Plugin $plugin;

public bool $hasCpSettings = true;
public string $schemaVersion = "2.0.0";

/**
* @param $id
Expand Down
5 changes: 3 additions & 2 deletions src/gql/interfaces/DAMAssetInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ class DAMAssetInterface extends AssetInterface {
*/
public static function getType($fields = null): Type
{
if ($type = GqlEntityRegistry::getEntity(self::class)) {
$name = "DAMAssetInterface";
if ($type = GqlEntityRegistry::getEntity($name)) {
return $type;
}

$type = GqlEntityRegistry::createEntity(self::class, new InterfaceType([
$type = GqlEntityRegistry::createEntity($name, new InterfaceType([
'name' => static::getName(),
'fields' => self::class . '::getFieldDefinitions',
'description' => 'This is the interface implemented by all DAM assets.',
Expand Down
45 changes: 45 additions & 0 deletions src/migrations/m230412_233209_namespace_change_migration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace lsst\dam\migrations;

use Craft;
use craft\db\Migration;

/**
* m230412_233209_namespace_change_migration migration.
*/
class m230412_233209_namespace_change_migration extends Migration
{
/**
* @inheritdoc
*/
public function safeUp(): bool
{
echo "m230412_233209_namespace_change_migration executing...\n";

$this->update('{{%fields}}', [
"type" => 'lsst\dam\fields\DAMAsset'
],[
"type" => 'rosas\dam\fields\DAMAsset'
]
);

return true;
}

/**
* @inheritdoc
*/
public function safeDown(): bool
{
echo "m230412_233209_namespace_change_migration is be reverted.\n";

$this->update('{{%fields}}', [
"type" => 'rosas\dam\fields\DAMAsset'
],[
"type" => 'lsst\dam\fields\DAMAsset'
]
);
return true;
}
}
14 changes: 4 additions & 10 deletions src/services/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,18 +291,12 @@ public function getAuthToken($validateOnly = false) : string {

return $authToken;
} else {
Craft::info("An exception occurred in getAuthToken()", "UDAMI");
return [
"status" => "error",
'errorMessage' => 'An error occurred fetching auth token!'
];
Craft::warn("An exception occurred in getAuthToken()", "UDAMI");
return 'An error occurred fetching auth token!';
}
} else {
Craft::info("An exception occurred in getAuthToken()", "UDAMI");
return [
"status" => "error",
'errorMessage' => 'DamPlugin is not configured to authenticate!'
];
Craft::warn("An exception occurred in getAuthToken()", "UDAMI");
return 'DamPlugin is not configured to authenticate!';
}

}
Expand Down

0 comments on commit 2646ffa

Please sign in to comment.