mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-01 13:34:33 +00:00
feat(storage): add team auto-archive assets policy and background job (#516)
* feat(storage): add team auto-archive assets policy and background job * fix(storage): address code review feedback on lock safety, starvation, and permissions * docs: update readme and expand archive storage documentation with auto-archive details * feat(storage): log info message on auto-archive job start and finish with archived count * style(storage): stack age threshold and grace period vertically with updated grace period description * fix(storage): only log auto-archive info messages when candidate assets are found to process
This commit is contained in:
@@ -110,6 +110,32 @@ export type HlsResolutionLadder = (typeof HlsResolutionLadder)[keyof typeof HlsR
|
||||
|
||||
export const DEFAULT_HLS_RESOLUTIONS: HlsResolutionLadder[] = ['480p', '720p', '1080p']
|
||||
|
||||
export const autoArchiveMethodSchema = z.enum(['not_updated', 'after_created'])
|
||||
export type AutoArchiveMethod = z.infer<typeof autoArchiveMethodSchema>
|
||||
|
||||
export const autoArchiveSettingsSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
method: autoArchiveMethodSchema,
|
||||
days: z.number().int().min(1).max(3650),
|
||||
postRestoreGraceDays: z.number().int().min(1).max(3650).default(30),
|
||||
})
|
||||
export type AutoArchiveSettings = z.infer<typeof autoArchiveSettingsSchema>
|
||||
|
||||
export const DEFAULT_AUTO_ARCHIVE_SETTINGS: AutoArchiveSettings = {
|
||||
enabled: false,
|
||||
method: 'not_updated',
|
||||
days: 30,
|
||||
postRestoreGraceDays: 30,
|
||||
}
|
||||
|
||||
export interface ArchiveStorageInfo {
|
||||
enabled: boolean
|
||||
backend?: 'local' | 's3'
|
||||
endpoint?: string
|
||||
bucket?: string
|
||||
localRoot?: string
|
||||
}
|
||||
|
||||
export const updateTeamSettingsRequestSchema = z.union([
|
||||
z.object({
|
||||
key: z.literal('transcode.videoStrategy'),
|
||||
@@ -139,6 +165,26 @@ export const updateTeamSettingsRequestSchema = z.union([
|
||||
key: z.literal('appearance.hideAgent'),
|
||||
value: z.boolean(),
|
||||
}),
|
||||
z.object({
|
||||
key: z.literal('autoArchive'),
|
||||
value: autoArchiveSettingsSchema,
|
||||
}),
|
||||
z.object({
|
||||
key: z.literal('autoArchive.enabled'),
|
||||
value: z.boolean(),
|
||||
}),
|
||||
z.object({
|
||||
key: z.literal('autoArchive.method'),
|
||||
value: autoArchiveMethodSchema,
|
||||
}),
|
||||
z.object({
|
||||
key: z.literal('autoArchive.days'),
|
||||
value: z.number().int().min(1).max(3650),
|
||||
}),
|
||||
z.object({
|
||||
key: z.literal('autoArchive.postRestoreGraceDays'),
|
||||
value: z.number().int().min(1).max(3650),
|
||||
}),
|
||||
])
|
||||
export type UpdateTeamSettingsRequest = z.infer<typeof updateTeamSettingsRequestSchema>
|
||||
|
||||
@@ -189,6 +235,8 @@ export interface TeamSettingsResponse {
|
||||
gotenberg?: GotenbergSettingsResponse
|
||||
appearance?: TeamAppearanceSettings
|
||||
semanticSearchEnabled?: boolean
|
||||
archiveStorage?: ArchiveStorageInfo
|
||||
autoArchive?: AutoArchiveSettings
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user