mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
feat(server): Add week numbers for templating (#4263)
* add week numbers as template option * generate api * fix tests * change example date to show week padding * change example date to immich birthday
This commit is contained in:
@@ -7924,6 +7924,12 @@
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"weekOptions": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"yearOptions": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
@@ -7934,6 +7940,7 @@
|
||||
"required": [
|
||||
"yearOptions",
|
||||
"monthOptions",
|
||||
"weekOptions",
|
||||
"dayOptions",
|
||||
"hourOptions",
|
||||
"minuteOptions",
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
supportedMinuteTokens,
|
||||
supportedMonthTokens,
|
||||
supportedSecondTokens,
|
||||
supportedWeekTokens,
|
||||
supportedYearTokens,
|
||||
} from '../system-config';
|
||||
import { SystemConfigCore } from '../system-config/system-config.core';
|
||||
@@ -239,6 +240,7 @@ export class StorageTemplateService {
|
||||
const dateTokens = [
|
||||
...supportedYearTokens,
|
||||
...supportedMonthTokens,
|
||||
...supportedWeekTokens,
|
||||
...supportedDayTokens,
|
||||
...supportedHourTokens,
|
||||
...supportedMinuteTokens,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export class SystemConfigTemplateStorageOptionDto {
|
||||
yearOptions!: string[];
|
||||
monthOptions!: string[];
|
||||
weekOptions!: string[];
|
||||
dayOptions!: string[];
|
||||
hourOptions!: string[];
|
||||
minuteOptions!: string[];
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export const supportedYearTokens = ['y', 'yy'];
|
||||
export const supportedMonthTokens = ['M', 'MM', 'MMM', 'MMMM'];
|
||||
export const supportedWeekTokens = ['W', 'WW'];
|
||||
export const supportedDayTokens = ['d', 'dd'];
|
||||
export const supportedHourTokens = ['h', 'hh', 'H', 'HH'];
|
||||
export const supportedMinuteTokens = ['m', 'mm'];
|
||||
@@ -18,6 +19,7 @@ export const supportedPresetTokens = [
|
||||
'{{y}}-{{MMM}}-{{dd}}/{{filename}}',
|
||||
'{{y}}-{{MMMM}}-{{dd}}/{{filename}}',
|
||||
'{{y}}/{{y}}-{{MM}}/{{filename}}',
|
||||
'{{y}}/{{y}}-{{WW}}/{{filename}}',
|
||||
];
|
||||
|
||||
export const INITIAL_SYSTEM_CONFIG = 'INITIAL_SYSTEM_CONFIG';
|
||||
|
||||
@@ -221,8 +221,10 @@ describe(SystemConfigService.name, () => {
|
||||
'{{y}}-{{MMM}}-{{dd}}/{{filename}}',
|
||||
'{{y}}-{{MMMM}}-{{dd}}/{{filename}}',
|
||||
'{{y}}/{{y}}-{{MM}}/{{filename}}',
|
||||
'{{y}}/{{y}}-{{WW}}/{{filename}}',
|
||||
],
|
||||
secondOptions: ['s', 'ss'],
|
||||
weekOptions: ['W', 'WW'],
|
||||
yearOptions: ['y', 'yy'],
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
supportedMonthTokens,
|
||||
supportedPresetTokens,
|
||||
supportedSecondTokens,
|
||||
supportedWeekTokens,
|
||||
supportedYearTokens,
|
||||
} from './system-config.constants';
|
||||
import { SystemConfigCore, SystemConfigValidator } from './system-config.core';
|
||||
@@ -57,6 +58,7 @@ export class SystemConfigService {
|
||||
const options = new SystemConfigTemplateStorageOptionDto();
|
||||
|
||||
options.dayOptions = supportedDayTokens;
|
||||
options.weekOptions = supportedWeekTokens;
|
||||
options.monthOptions = supportedMonthTokens;
|
||||
options.yearOptions = supportedYearTokens;
|
||||
options.hourOptions = supportedHourTokens;
|
||||
|
||||
Reference in New Issue
Block a user