-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ save client id if status is created via app (#2251)
- Loading branch information
1 parent
e02a06a
commit 0090246
Showing
13 changed files
with
225 additions
and
58 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -10,7 +10,8 @@ | |
* title="Träwelling API", | ||
* description="Träwelling user API description. This is an incomplete documentation with still many errors. The | ||
* API is currently not yet stable. Endpoints are still being restructured. Both the URL and the request or body | ||
* can be changed. Breaking changes will be announced on the Discord server: https://discord.gg/72t7564ZbV", | ||
* can be changed. Breaking changes will be announced on GitHub: | ||
* https://github.com/Traewelling/traewelling/blob/develop/API_CHANGELOG.md", | ||
* @OA\Contact( | ||
* email="[email protected]" | ||
* ), | ||
|
@@ -90,7 +91,11 @@ public function sendResponse( | |
int $code = 200, | ||
array $additional = null | ||
): JsonResponse { | ||
$disclaimer = 'APIv1 is not officially released for use and is also not fully documented. You can find the documentation at https://traewelling.de/api/documentation. Use at your own risk. Data fields may change at any time without notice.'; | ||
$disclaimer = [ | ||
'message' => 'APIv1 is not officially released for use and is also not fully documented. Use at your own risk. Data fields may change at any time without notice.', | ||
'documentation' => 'https://traewelling.de/api/documentation', | ||
'changelog' => 'https://github.com/Traewelling/traewelling/blob/develop/API_CHANGELOG.md', | ||
]; | ||
if ($data === null) { | ||
return response()->json( | ||
data: [ | ||
|
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,19 @@ | ||
<?php | ||
|
||
namespace App\Http\Resources; | ||
|
||
use Illuminate\Http\Resources\Json\JsonResource; | ||
|
||
/** | ||
* Model -> OAuthClient | ||
*/ | ||
class ClientResource extends JsonResource | ||
{ | ||
public function toArray($request) { | ||
return [ | ||
'id' => $this->id, | ||
'name' => $this->name, | ||
'privacyPolicyUrl' => $this->privacy_policy_url, | ||
]; | ||
} | ||
} |
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,49 @@ | ||
<?php | ||
|
||
namespace App\Virtual\Models; | ||
|
||
/** | ||
* @OA\Schema( | ||
* title="Client", | ||
* description="Client model", | ||
* @OA\Xml( | ||
* name="Client" | ||
* ) | ||
* ) | ||
*/ | ||
class Client | ||
{ | ||
/** | ||
* @OA\Property( | ||
* title="ID", | ||
* description="ID", | ||
* format="int64", | ||
* example=39 | ||
* ) | ||
* | ||
* @var integer | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* @OA\Property ( | ||
* title="name", | ||
* description="Name of client", | ||
* example="Träwelling App" | ||
* ) | ||
* | ||
* @var string | ||
*/ | ||
private $name; | ||
|
||
/** | ||
* @OA\Property ( | ||
* title="privacyPolicyUrl", | ||
* description="URL to privacy policy", | ||
* example="https://traewelling.de/privacy-policy" | ||
* ) | ||
* | ||
* @var string | ||
*/ | ||
private $privacyPolicyUrl; | ||
} |
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
23 changes: 23 additions & 0 deletions
23
database/migrations/2023_12_29_000000_add_client_id_to_statuses.php
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,23 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
|
||
public function up(): void { | ||
Schema::table('statuses', function(Blueprint $table) { | ||
$table->unsignedBigInteger('client_id')->nullable()->after('tweet_id'); | ||
$table->foreign('client_id')->references('id')->on('oauth_clients')->nullOnDelete(); | ||
}); | ||
} | ||
|
||
public function down(): void { | ||
Schema::table('statuses', function(Blueprint $table) { | ||
$table->dropForeign(['client_id']); | ||
$table->dropColumn('client_id'); | ||
}); | ||
} | ||
}; |
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.