feat: add audit and app log services

This commit is contained in:
QiuSW
2026-07-09 00:55:46 +08:00
parent 3bd05b316e
commit 769c861eb0
20 changed files with 804 additions and 30 deletions
@@ -6,6 +6,118 @@
// @ts-ignore: Unused imports
import {Create as $Create} from "@wailsio/runtime";
export class AppLog {
/**
* Creates a new AppLog instance.
* @param {Partial<AppLog>} [$$source = {}] - The source object to create the AppLog.
*/
constructor($$source = {}) {
if (!("id" in $$source)) {
/**
* @member
* @type {number}
*/
this["id"] = 0;
}
if (!("level" in $$source)) {
/**
* @member
* @type {string}
*/
this["level"] = "";
}
if (!("module" in $$source)) {
/**
* @member
* @type {string}
*/
this["module"] = "";
}
if (!("message" in $$source)) {
/**
* @member
* @type {string}
*/
this["message"] = "";
}
if (!("detail" in $$source)) {
/**
* @member
* @type {string}
*/
this["detail"] = "";
}
if (!("createdAt" in $$source)) {
/**
* @member
* @type {string}
*/
this["createdAt"] = "";
}
Object.assign(this, $$source);
}
/**
* Creates a new AppLog instance from a string or object.
* @param {any} [$$source = {}]
* @returns {AppLog}
*/
static createFrom($$source = {}) {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new AppLog(/** @type {Partial<AppLog>} */($$parsedSource));
}
}
export class AppLogFilter {
/**
* Creates a new AppLogFilter instance.
* @param {Partial<AppLogFilter>} [$$source = {}] - The source object to create the AppLogFilter.
*/
constructor($$source = {}) {
if (!("level" in $$source)) {
/**
* @member
* @type {string}
*/
this["level"] = "";
}
if (!("module" in $$source)) {
/**
* @member
* @type {string}
*/
this["module"] = "";
}
if (!("limit" in $$source)) {
/**
* @member
* @type {number}
*/
this["limit"] = 0;
}
if (!("offset" in $$source)) {
/**
* @member
* @type {number}
*/
this["offset"] = 0;
}
Object.assign(this, $$source);
}
/**
* Creates a new AppLogFilter instance from a string or object.
* @param {any} [$$source = {}]
* @returns {AppLogFilter}
*/
static createFrom($$source = {}) {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new AppLogFilter(/** @type {Partial<AppLogFilter>} */($$parsedSource));
}
}
export class AppSettingDefinition {
/**
* Creates a new AppSettingDefinition instance.
@@ -182,6 +294,132 @@ export class AppSettingOption {
}
}
export class AuditLog {
/**
* Creates a new AuditLog instance.
* @param {Partial<AuditLog>} [$$source = {}] - The source object to create the AuditLog.
*/
constructor($$source = {}) {
if (!("id" in $$source)) {
/**
* @member
* @type {number}
*/
this["id"] = 0;
}
if (!("actor" in $$source)) {
/**
* @member
* @type {string}
*/
this["actor"] = "";
}
if (!("action" in $$source)) {
/**
* @member
* @type {string}
*/
this["action"] = "";
}
if (!("targetType" in $$source)) {
/**
* @member
* @type {string}
*/
this["targetType"] = "";
}
if (!("targetId" in $$source)) {
/**
* @member
* @type {string}
*/
this["targetId"] = "";
}
if (!("detail" in $$source)) {
/**
* @member
* @type {string}
*/
this["detail"] = "";
}
if (!("createdAt" in $$source)) {
/**
* @member
* @type {string}
*/
this["createdAt"] = "";
}
Object.assign(this, $$source);
}
/**
* Creates a new AuditLog instance from a string or object.
* @param {any} [$$source = {}]
* @returns {AuditLog}
*/
static createFrom($$source = {}) {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new AuditLog(/** @type {Partial<AuditLog>} */($$parsedSource));
}
}
export class AuditLogFilter {
/**
* Creates a new AuditLogFilter instance.
* @param {Partial<AuditLogFilter>} [$$source = {}] - The source object to create the AuditLogFilter.
*/
constructor($$source = {}) {
if (!("actor" in $$source)) {
/**
* @member
* @type {string}
*/
this["actor"] = "";
}
if (!("action" in $$source)) {
/**
* @member
* @type {string}
*/
this["action"] = "";
}
if (!("targetType" in $$source)) {
/**
* @member
* @type {string}
*/
this["targetType"] = "";
}
if (!("limit" in $$source)) {
/**
* @member
* @type {number}
*/
this["limit"] = 0;
}
if (!("offset" in $$source)) {
/**
* @member
* @type {number}
*/
this["offset"] = 0;
}
Object.assign(this, $$source);
}
/**
* Creates a new AuditLogFilter instance from a string or object.
* @param {any} [$$source = {}]
* @returns {AuditLogFilter}
*/
static createFrom($$source = {}) {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new AuditLogFilter(/** @type {Partial<AuditLogFilter>} */($$parsedSource));
}
}
export class AuthProviderOption {
/**
* Creates a new AuthProviderOption instance.
@@ -0,0 +1,40 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import {Call as $Call, Create as $Create} from "@wailsio/runtime";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as models$0 from "../models/models.js";
/**
* @param {models$0.AppLogFilter} filter
* @returns {Promise<models$0.AppLog[]> & { cancel(): void }}
*/
export function List(filter) {
let $resultPromise = /** @type {any} */($Call.ByID(3950321256, filter));
let $typingPromise = /** @type {any} */($resultPromise.then(($result) => {
return $$createType1($result);
}));
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
return $typingPromise;
}
/**
* @param {string} level
* @param {string} $module
* @param {string} message
* @param {string} detail
* @returns {Promise<void> & { cancel(): void }}
*/
export function Record(level, $module, message, detail) {
let $resultPromise = /** @type {any} */($Call.ByID(1131123237, level, $module, message, detail));
return $resultPromise;
}
// Private type creation functions
const $$createType0 = models$0.AppLog.createFrom;
const $$createType1 = $Create.Array($$createType0);
@@ -0,0 +1,40 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import {Call as $Call, Create as $Create} from "@wailsio/runtime";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as models$0 from "../models/models.js";
/**
* @param {models$0.AuditLogFilter} filter
* @returns {Promise<models$0.AuditLog[]> & { cancel(): void }}
*/
export function List(filter) {
let $resultPromise = /** @type {any} */($Call.ByID(1985320716, filter));
let $typingPromise = /** @type {any} */($resultPromise.then(($result) => {
return $$createType1($result);
}));
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
return $typingPromise;
}
/**
* @param {string} action
* @param {string} targetType
* @param {string} targetID
* @param {string} detail
* @returns {Promise<void> & { cancel(): void }}
*/
export function Record(action, targetType, targetID, detail) {
let $resultPromise = /** @type {any} */($Call.ByID(1661109649, action, targetType, targetID, detail));
return $resultPromise;
}
// Private type creation functions
const $$createType0 = models$0.AuditLog.createFrom;
const $$createType1 = $Create.Array($$createType0);
@@ -3,7 +3,9 @@
// This file is automatically generated. DO NOT EDIT
import * as AppConfigService from "./appconfigservice.js";
import * as AppLogService from "./applogservice.js";
import * as AppService from "./appservice.js";
import * as AuditLogService from "./auditlogservice.js";
import * as AuthService from "./authservice.js";
import * as HotkeyService from "./hotkeyservice.js";
import * as ImageOptimizationService from "./imageoptimizationservice.js";
@@ -11,7 +13,9 @@ import * as OCRService from "./ocrservice.js";
import * as SystemInfo from "./systeminfo.js";
export {
AppConfigService,
AppLogService,
AppService,
AuditLogService,
AuthService,
HotkeyService,
ImageOptimizationService,