+
+
+
Neue Lizenz anlegen
-
- N
-
+ N
@@ -159,37 +202,33 @@ const remToPx = (rem: number) => {
-
-
-
+
-
+
–
+ @update:model-value="(value) => license.expirationDate = value as string"
+ placeholder="Datum" />
-
+
-
+
-
+
-
+
diff --git a/resources/js/services/LicenseService.ts b/resources/js/services/LicenseService.ts
index 4f4804c..af98a40 100644
--- a/resources/js/services/LicenseService.ts
+++ b/resources/js/services/LicenseService.ts
@@ -1,5 +1,5 @@
import axios, { AxiosError } from 'axios';
-import { License } from '@/types';
+import { License, LicenseValidationInfo } from '@/types';
import { toast } from 'vue-sonner';
const API_URL = '/api/licenses';
@@ -53,7 +53,7 @@ export default {
},
/**
- * Updates an existing license
+ * Updates one existing license
* @param license - The license data to update
* @returns Promise
*/
@@ -68,6 +68,22 @@ export default {
}
},
+ /**
+ * Updates multiple licenses in one request.
+ * @param licenses - The dirty license data to update
+ * @returns Promise
+ */
+ async updateLicenses(licenses: License[]): Promise {
+ try {
+ const response = await axios.put(API_URL, licenses);
+ return response.data;
+ } catch (error) {
+ toast.error('Fehler beim Aktualisieren der Lizenzen', { description: (error as AxiosError).message });
+ console.error(error);
+ return null;
+ }
+ },
+
/**
* Deletes a license by ID
* @param id - The ID of the license to delete
@@ -113,9 +129,9 @@ export default {
* @param licenseId - The ID of the license to validate
* @returns Promise<{ is_valid: boolean, is_signature_valid: boolean, is_expired: boolean } | null>
*/
- async validateLicense(license: License): Promise<{ isValid: boolean, isSignatureValid: boolean, isExpired: boolean } | null> {
+ async validateLicense(license: License): Promise {
try {
- const response = await axios.post('/api/licenses/validate', { license });
+ const response = await axios.post('/api/licenses/validate', license);
return response.data;
} catch (error) {
toast.error('Fehler beim Validieren der Lizenz', { description: (error as AxiosError).message });
diff --git a/routes/api.php b/routes/api.php
index 2b5ae7c..3b0d8f5 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -60,6 +60,7 @@
Route::get('/licenses/{id}', [\App\Http\Controllers\LicenseController::class, 'single']);
Route::delete('/licenses/{id}', [\App\Http\Controllers\LicenseController::class, 'destroy']);
Route::post('/licenses', [\App\Http\Controllers\LicenseController::class, 'store']);
+Route::put('/licenses', [\App\Http\Controllers\LicenseController::class, 'updateMany']);
Route::put('/licenses/{id}', [\App\Http\Controllers\LicenseController::class, 'update']);
Route::post('/licenses/validate', [\App\Http\Controllers\LicenseController::class, 'validate']);