diff options
Diffstat (limited to 'Timeline/Entities')
-rw-r--r-- | Timeline/Entities/Common.cs | 12 | ||||
-rw-r--r-- | Timeline/Entities/Http/Common.cs | 29 | ||||
-rw-r--r-- | Timeline/Entities/Http/Token.cs (renamed from Timeline/Entities/Token.cs) | 2 | ||||
-rw-r--r-- | Timeline/Entities/Http/User.cs | 26 | ||||
-rw-r--r-- | Timeline/Entities/User.cs | 30 |
5 files changed, 56 insertions, 43 deletions
diff --git a/Timeline/Entities/Common.cs b/Timeline/Entities/Common.cs deleted file mode 100644 index 235a2a20..00000000 --- a/Timeline/Entities/Common.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Timeline.Entities -{ - public class MessageResponse - { - public MessageResponse(string message) - { - Message = message; - } - - public string Message { get; set; } - } -} diff --git a/Timeline/Entities/Http/Common.cs b/Timeline/Entities/Http/Common.cs new file mode 100644 index 00000000..9575e6fa --- /dev/null +++ b/Timeline/Entities/Http/Common.cs @@ -0,0 +1,29 @@ +namespace Timeline.Entities.Http +{ + public class ReturnCodeMessageResponse + { + public ReturnCodeMessageResponse() + { + + } + + public ReturnCodeMessageResponse(int code) + { + ReturnCode = code; + } + + public ReturnCodeMessageResponse(string message) + { + Message = message; + } + + public ReturnCodeMessageResponse(int code, string message) + { + ReturnCode = code; + Message = message; + } + + public int? ReturnCode { get; set; } = null; + public string Message { get; set; } = null; + } +} diff --git a/Timeline/Entities/Token.cs b/Timeline/Entities/Http/Token.cs index 1b5a469d..45ee0fc5 100644 --- a/Timeline/Entities/Token.cs +++ b/Timeline/Entities/Http/Token.cs @@ -1,4 +1,4 @@ -namespace Timeline.Entities +namespace Timeline.Entities.Http { public class CreateTokenRequest { diff --git a/Timeline/Entities/Http/User.cs b/Timeline/Entities/Http/User.cs new file mode 100644 index 00000000..24952ac7 --- /dev/null +++ b/Timeline/Entities/Http/User.cs @@ -0,0 +1,26 @@ +namespace Timeline.Entities.Http +{ + public class UserModifyRequest + { + public string Password { get; set; } + public string[] Roles { get; set; } + } + + public static class UserPutResponse + { + public const int CreatedCode = 0; + public const int ModifiedCode = 1; + + public static ReturnCodeMessageResponse Created { get; } = new ReturnCodeMessageResponse(CreatedCode, "A new user is created."); + public static ReturnCodeMessageResponse Modified { get; } = new ReturnCodeMessageResponse(ModifiedCode, "A existing user is modified."); + } + + public static class UserDeleteResponse + { + public const int DeletedCode = 0; + public const int NotExistsCode = 1; + + public static ReturnCodeMessageResponse Deleted { get; } = new ReturnCodeMessageResponse(DeletedCode, "A existing user is deleted."); + public static ReturnCodeMessageResponse NotExists { get; } = new ReturnCodeMessageResponse(NotExistsCode, "User with given name does not exists."); + } +} diff --git a/Timeline/Entities/User.cs b/Timeline/Entities/User.cs deleted file mode 100644 index eb126165..00000000 --- a/Timeline/Entities/User.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace Timeline.Entities -{ - public class UserModifyRequest - { - public string Password { get; set; } - public string[] Roles { get; set; } - } - - public class UserPutResponse - { - public const int CreatedCode = 0; - public const int ModifiedCode = 1; - - public static UserPutResponse Created { get; } = new UserPutResponse { ReturnCode = CreatedCode }; - public static UserPutResponse Modified { get; } = new UserPutResponse { ReturnCode = ModifiedCode }; - - public int ReturnCode { get; set; } - } - - public class UserDeleteResponse - { - public const int SuccessCode = 0; - public const int NotExistsCode = 1; - - public static UserDeleteResponse Success { get; } = new UserDeleteResponse { ReturnCode = SuccessCode }; - public static UserDeleteResponse NotExists { get; } = new UserDeleteResponse { ReturnCode = NotExistsCode }; - - public int ReturnCode { get; set; } - } -} |