mirror of
https://github.com/nikdoof/pocket-id.git
synced 2025-12-14 15:22:18 +00:00
fix: session duration can't be updated
This commit is contained in:
@@ -17,4 +17,5 @@ type AppConfig struct {
|
|||||||
|
|
||||||
type AppConfigUpdateDto struct {
|
type AppConfigUpdateDto struct {
|
||||||
AppName string `json:"appName" binding:"required"`
|
AppName string `json:"appName" binding:"required"`
|
||||||
|
SessionDuration string `json:"sessionDuration" binding:"required"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ var defaultDbConfig = model.AppConfig{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *AppConfigService) UpdateApplicationConfiguration(input model.AppConfigUpdateDto) ([]model.AppConfigVariable, error) {
|
func (s *AppConfigService) UpdateApplicationConfiguration(input model.AppConfigUpdateDto) ([]model.AppConfigVariable, error) {
|
||||||
savedConfigVariables := make([]model.AppConfigVariable, 10)
|
var savedConfigVariables []model.AppConfigVariable
|
||||||
|
|
||||||
tx := s.db.Begin()
|
tx := s.db.Begin()
|
||||||
rt := reflect.ValueOf(input).Type()
|
rt := reflect.ValueOf(input).Type()
|
||||||
@@ -78,7 +78,7 @@ func (s *AppConfigService) UpdateApplicationConfiguration(input model.AppConfigU
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
savedConfigVariables[i] = applicationConfigurationVariable
|
savedConfigVariables = append(savedConfigVariables, applicationConfigurationVariable)
|
||||||
}
|
}
|
||||||
|
|
||||||
tx.Commit()
|
tx.Commit()
|
||||||
|
|||||||
@@ -10,10 +10,14 @@ test('Update general configuration', async ({ page }) => {
|
|||||||
await page.getByLabel('Session Duration').fill('30');
|
await page.getByLabel('Session Duration').fill('30');
|
||||||
await page.getByRole('button', { name: 'Save' }).first().click();
|
await page.getByRole('button', { name: 'Save' }).first().click();
|
||||||
|
|
||||||
await expect(page.getByTestId('application-name')).toHaveText('Updated Name');
|
|
||||||
await expect(page.getByRole('status')).toHaveText(
|
await expect(page.getByRole('status')).toHaveText(
|
||||||
'Application configuration updated successfully'
|
'Application configuration updated successfully'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await page.reload();
|
||||||
|
|
||||||
|
await expect(page.getByTestId('application-name')).toHaveText('Updated Name');
|
||||||
|
await expect(page.getByTestId('session-duration')).toHaveText('30');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Update application images', async ({ page }) => {
|
test('Update application images', async ({ page }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user