Skip to content

Commit

Permalink
1. 取消 Value 值必填的限制
Browse files Browse the repository at this point in the history
2. User 表 Id 跟 Name 的长度放到 256
  • Loading branch information
agile.zhou committed Sep 11, 2023
1 parent 721b602 commit 1a10612
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,6 @@ public async Task<IActionResult> Delete(string id, string env)
{
return (false, "Key不能为空");
}
if (string.IsNullOrEmpty(model.Value))
{
return (false, "Value不能为空");
}
if (string.IsNullOrEmpty(model.AppId))
{
return (false, "AppId不能为空");
Expand Down
1 change: 0 additions & 1 deletion src/AgileConfig.Server.Apisite/Models/ConfigVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class ConfigVM: IAppIdModel
[MaxLength(100, ErrorMessage = "配置键长度不能超过100位")]
public string Key { get; set; }

[Required(ErrorMessage = "配置值不能为空")]
[MaxLength(4000, ErrorMessage = "配置值长度不能超过4000位")]
public string Value { get; set; }

Expand Down
5 changes: 2 additions & 3 deletions src/AgileConfig.Server.Data.Entity/User.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
using FreeSql.DataAnnotations;
using System;
using System.Diagnostics;

namespace AgileConfig.Server.Data.Entity
{
[Table(Name = "agc_user")]
[OraclePrimaryKeyName("agc_user_pk")]
public class User
{
[Column(Name = "id", StringLength = 50)]
[Column(Name = "id", StringLength = 256)]
public string Id { get; set; }

[Column(Name= "user_name" , StringLength = 50)]
[Column(Name= "user_name" , StringLength = 256)]
public string UserName { get; set; }

[Column(Name = "password", StringLength = 50)]
Expand Down
12 changes: 12 additions & 0 deletions src/AgileConfig.Server.Service/ConfigService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public async Task<string> IfEnvEmptySetDefaultAsync(string env)

public async Task<bool> AddAsync(Config config, string env)
{
if (config.Value == null)
{
config.Value = "";
}

using var dbcontext = FreeSqlDbContextFactory.Create(env);

await dbcontext.Configs.AddAsync(config);
Expand Down Expand Up @@ -352,6 +357,13 @@ private void ClearAppPublishedConfigsMd5CacheWithInheritanced(string appId, stri

public async Task<bool> AddRangeAsync(List<Config> configs, string env)
{
configs.ForEach(x => {
if (x.Value == null)
{
x.Value = "";
}
});

using var dbcontext = FreeSqlDbContextFactory.Create(env);

await dbcontext.Configs.AddRangeAsync(configs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ export default {
'pages.configs.table.cols.action.offline': 'Offline',
'pages.configs.table.cols.action.history': 'History',

'pages.configs.from.add.title': 'Create',
'pages.configs.from.title.add': 'Create',
'pages.configs.from.title.edit': 'Edit',
'pages.configs.from.add.app': 'App',
'pages.configs.from.importjson.selectfile': 'Select file',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ export default {
'pages.configs.table.cols.action.offline': '下线',
'pages.configs.table.cols.action.history': '历史',

'pages.configs.from.add.title': '新建配置',
'pages.configs.from.title.add': '新建配置',
'pages.configs.from.title.edit': '编辑配置',
'pages.configs.from.add.app': '应用',
'pages.configs.from.importjson.selectfile': '选择文件',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const UpdateForm : React.FC<UpdateFormProps> = (props)=>{

return (
<ModalForm
title={intl.formatMessage({id:'pages.configs.from.add.title'})}
title={intl.formatMessage({id:'pages.configs.from.title.edit'})}
initialValues={props.value}
visible={props.updateModalVisible}
modalProps={
Expand Down Expand Up @@ -79,7 +79,7 @@ const UpdateForm : React.FC<UpdateFormProps> = (props)=>{
<ProFormTextArea
rules={[
{
required: true,
required: false,
},
]}
label={intl.formatMessage({id:'pages.configs.table.cols.v'})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ const configs: React.FC = (props: any) => {
}
}
formRef={addFormRef}
title={intl.formatMessage({id:'pages.configs.from.add.title'})}
title={intl.formatMessage({id:'pages.configs.from.title.add'})}
visible={createModalVisible}
onVisibleChange={setCreateModalVisible}
onFinish={
Expand Down Expand Up @@ -746,7 +746,7 @@ const configs: React.FC = (props: any) => {
<ProFormTextArea
rules={[
{
required: true,
required: false,
},
]}
label={intl.formatMessage({id:'pages.configs.table.cols.v'})}
Expand Down

0 comments on commit 1a10612

Please sign in to comment.