Phase 3: Initial commit - Nextcloud Analytics Hub Project
Nextcloud Analytics Hub complete: - Nextcloud PHP app (analytics-hub/) - All phases (1-3) complete - Go client tool (nextcloud-analytics) - Full CLI implementation - Documentation (PRD, README, STATUS, SKILL.md) - Production-ready for deployment to https://cloud.shortcutsolutions.net Repository: git.teamworkapps.com/shortcut/nextcloud-analytics Workspace: /home/molt/.openclaw/workspace
This commit is contained in:
110
analytics-hub/lib/Model/ClientConfig.php
Normal file
110
analytics-hub/lib/Model/ClientConfig.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\AnalyticsHub\Model;
|
||||
|
||||
/**
|
||||
* Client configuration model
|
||||
*/
|
||||
class ClientConfig {
|
||||
|
||||
private int $id;
|
||||
private string $propertyId;
|
||||
private string $name;
|
||||
private string $slug;
|
||||
private bool $active;
|
||||
private ?array $context;
|
||||
private ?array $webdavConfig;
|
||||
private ?array $thresholds;
|
||||
|
||||
public function __construct(
|
||||
int $id,
|
||||
string $propertyId,
|
||||
string $name,
|
||||
string $slug,
|
||||
bool $active = true,
|
||||
?array $context = null,
|
||||
?array $webdavConfig = null,
|
||||
?array $thresholds = null
|
||||
) {
|
||||
$this->id = $id;
|
||||
$this->propertyId = $propertyId;
|
||||
$this->name = $name;
|
||||
$this->slug = $slug;
|
||||
$this->active = $active;
|
||||
$this->context = $context;
|
||||
$this->webdavConfig = $webdavConfig;
|
||||
$this->thresholds = $thresholds;
|
||||
}
|
||||
|
||||
// Getters
|
||||
public function getId(): int {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getPropertyId(): string {
|
||||
return $this->propertyId;
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getSlug(): string {
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
public function isActive(): bool {
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function getContext(): ?array {
|
||||
return $this->context;
|
||||
}
|
||||
|
||||
public function getWebdavConfig(): ?array {
|
||||
return $this->webdavConfig;
|
||||
}
|
||||
|
||||
public function getThresholds(): ?array {
|
||||
return $this->thresholds;
|
||||
}
|
||||
|
||||
// Setters
|
||||
public function setActive(bool $active): void {
|
||||
$this->active = $active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create from JSON
|
||||
*/
|
||||
public static function fromJson(array $data): self {
|
||||
return new self(
|
||||
(int)($data['id'] ?? 0),
|
||||
(string)($data['property_id'] ?? ''),
|
||||
(string)($data['name'] ?? ''),
|
||||
(string)($data['slug'] ?? ''),
|
||||
(bool)($data['active'] ?? true),
|
||||
$data['context'] ?? null,
|
||||
$data['webdav_config'] ?? null,
|
||||
$data['thresholds'] ?? null
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert to array
|
||||
*/
|
||||
public function toArray(): array {
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'property_id' => $this->propertyId,
|
||||
'name' => $this->name,
|
||||
'slug' => $this->slug,
|
||||
'active' => $this->active,
|
||||
'context' => $this->context,
|
||||
'webdav_config' => $this->webdavConfig,
|
||||
'thresholds' => $this->thresholds,
|
||||
];
|
||||
}
|
||||
}
|
||||
81
analytics-hub/lib/Model/Report.php
Normal file
81
analytics-hub/lib/Model/Report.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\AnalyticsHub\Model;
|
||||
|
||||
/**
|
||||
* Report model
|
||||
*/
|
||||
class Report {
|
||||
|
||||
private int $id;
|
||||
private int $clientId;
|
||||
private string $clientName;
|
||||
private string $reportDate;
|
||||
private string $filePath;
|
||||
private ?int $fileSize;
|
||||
private string $createdAt;
|
||||
|
||||
public function __construct(
|
||||
int $id,
|
||||
int $clientId,
|
||||
string $clientName,
|
||||
string $reportDate,
|
||||
string $filePath,
|
||||
?int $fileSize = null,
|
||||
string $createdAt
|
||||
) {
|
||||
$this->id = $id;
|
||||
$this->clientId = $clientId;
|
||||
$this->clientName = $clientName;
|
||||
$this->reportDate = $reportDate;
|
||||
$this->filePath = $filePath;
|
||||
$this->fileSize = $fileSize;
|
||||
$this->createdAt = $createdAt;
|
||||
}
|
||||
|
||||
// Getters
|
||||
public function getId(): int {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getClientId(): int {
|
||||
return $this->clientId;
|
||||
}
|
||||
|
||||
public function getClientName(): string {
|
||||
return $this->clientName;
|
||||
}
|
||||
|
||||
public function getReportDate(): string {
|
||||
return $this->reportDate;
|
||||
}
|
||||
|
||||
public function getFilePath(): string {
|
||||
return $this->filePath;
|
||||
}
|
||||
|
||||
public function getFileSize(): ?int {
|
||||
return $this->fileSize;
|
||||
}
|
||||
|
||||
public function getCreatedAt(): string {
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert to array
|
||||
*/
|
||||
public function toArray(): array {
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'client_id' => $this->clientId,
|
||||
'client_name' => $this->clientName,
|
||||
'report_date' => $this->reportDate,
|
||||
'file_path' => $this->filePath,
|
||||
'file_size' => $this->fileSize,
|
||||
'created_at' => $this->createdAt,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user