diff --git a/src/Assets/logo.ico b/src/Assets/logo.ico index 207046a..def3bbe 100644 Binary files a/src/Assets/logo.ico and b/src/Assets/logo.ico differ diff --git a/src/Assets/logo.png b/src/Assets/logo.png index 733f8e0..b346a86 100644 Binary files a/src/Assets/logo.png and b/src/Assets/logo.png differ diff --git a/src/Security/MicroRoleModel.cs b/src/Security/MicroRoleModel.cs new file mode 100644 index 0000000..ca2f030 --- /dev/null +++ b/src/Security/MicroRoleModel.cs @@ -0,0 +1,40 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Security +{ + using System; + using System.ComponentModel.DataAnnotations; + + /// + /// This class contains the bare minimum properties to represent a role in the interface. + /// + public class MicroRoleModel + { + /// + /// Gets or sets the role identifier. + /// + /// The role identifier. + public Guid RoleId { get; set; } + + /// + /// Gets or sets the name. + /// + /// The name. + [Required] + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/Security/MicroUserModel.cs b/src/Security/MicroUserModel.cs new file mode 100644 index 0000000..31a19eb --- /dev/null +++ b/src/Security/MicroUserModel.cs @@ -0,0 +1,69 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Security +{ + using System; + using System.ComponentModel.DataAnnotations; + + /// + /// This class contains the bare minimum properties to represent a user in the interface. + /// + public class MicroUserModel + { + /// + /// Gets or sets the unique identity of the user. + /// + public Guid UserId { get; set; } + + /// + /// Gets or sets the user's e-mail address. + /// + [StringLength(100)] + public string Email { get; set; } + + /// + /// Gets or sets the first name. + /// + /// The first name. + [StringLength(100)] + public string FirstName { get; set; } + + /// + /// Gets or sets the last name. + /// + /// The last name. + [StringLength(100)] + public string LastName { get; set; } + + /// + /// Gets the user full name. + /// + public string FullName + { + get + { + return $"{this.FirstName} {this.LastName}".Trim(); + } + } + + /// + /// Gets or sets the user name of the user. + /// + [StringLength(100)] + public string UserName { get; set; } + } +} \ No newline at end of file diff --git a/src/Security/MinimalRoleModel.cs b/src/Security/MinimalRoleModel.cs new file mode 100644 index 0000000..05f418f --- /dev/null +++ b/src/Security/MinimalRoleModel.cs @@ -0,0 +1,60 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Security +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + + /// + /// Contains an enumerated list of role types. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RoleTypes + { + /// + /// System Roles Cannot be Deleted. + /// + System, + + /// + /// User Defined Roles. + /// + Defined + } + + /// + /// This class represents a minimal representation of a security role. + /// + public class MinimalRoleModel : MicroRoleModel + { + /// + /// Gets or sets the role description. + /// + public string Description { get; set; } + + /// + /// Gets or sets the type of the role. + /// + /// The type of the role. + public RoleTypes RoleType { get; set; } + + /// + /// Gets or sets a value indicating whether the role is a system role and cannot be deleted. + /// + public bool Deleteable { get; set; } + } +} \ No newline at end of file diff --git a/src/Security/MinimalUserModel.cs b/src/Security/MinimalUserModel.cs new file mode 100644 index 0000000..b48db65 --- /dev/null +++ b/src/Security/MinimalUserModel.cs @@ -0,0 +1,47 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Security +{ + using System; + + /// + /// This class represents a user that is assigned to a role. It is a stripped down version of the user and returns only essential information related to the + /// user for role associations. + /// + public class MinimalUserModel : MicroUserModel + { + /// + /// Gets or sets the user's desired language. + /// + public string Locale { get; set; } + + /// + /// Gets or sets the user's time zone. + /// + public string TimeZone { get; set; } + + /// + /// Gets a value indicating whether the user is locked. + /// + public bool Locked => this.LockExpirationDate.HasValue; + + /// + /// Gets or sets the lock expiration date. + /// + public DateTime? LockExpirationDate { get; set; } + } +} \ No newline at end of file diff --git a/src/Security/Queries/RoleQueryFilterModel.cs b/src/Security/Queries/RoleQueryFilterModel.cs new file mode 100644 index 0000000..809a9ae --- /dev/null +++ b/src/Security/Queries/RoleQueryFilterModel.cs @@ -0,0 +1,33 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Security.Queries +{ + using Talegen.Common.Models.Shared.Queries; + + /// + /// This class defines the administration role query filter model. + /// + /// + public class RoleQueryFilterModel : PaginatedQueryRequestModel + { + /// + /// Gets or sets the search text. + /// + /// The search text. + public string SearchText { get; set; } + } +} \ No newline at end of file diff --git a/src/Security/Queries/UserQueryFilterModel.cs b/src/Security/Queries/UserQueryFilterModel.cs new file mode 100644 index 0000000..a45bcc4 --- /dev/null +++ b/src/Security/Queries/UserQueryFilterModel.cs @@ -0,0 +1,39 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Security.Queries +{ + using Talegen.Common.Models.Shared.Queries; + + /// + /// This class defines the administration user query filter model. + /// + /// + public class UserQueryFilterModel : PaginatedQueryRequestModel + { + /// + /// Gets or sets the search text. + /// + /// The search text. + public string SearchText { get; set; } + + /// + /// Gets or sets a value indicating whether the search filter should show only active users. + /// + /// true if only active; otherwise, false and return all users. + public bool OnlyActive { get; set; } = true; + } +} \ No newline at end of file diff --git a/src/Security/RoleModel.cs b/src/Security/RoleModel.cs new file mode 100644 index 0000000..943296d --- /dev/null +++ b/src/Security/RoleModel.cs @@ -0,0 +1,63 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Security +{ + using System; + using System.Collections.Generic; + + /// + /// This model class represents a security role within the application. + /// + public class RoleModel : MinimalRoleModel + { + /// + /// Gets or sets the record created date time. + /// + public DateTime CreatedDate { get; set; } + + /// + /// Gets or sets the user model for the creating user. + /// + public MicroUserModel CreatedBy { get; set; } + + /// + /// Gets or sets the record last updated date time. + /// + public DateTime? UpdatedDate { get; set; } + + /// + /// Gets or sets the user model for the updating user. + /// + public MicroUserModel UpdatedBy { get; set; } + + /// + /// Gets or sets a value indicating whether the role is automatically added to users when they are synchronized via the application subscription Redis channel. + /// + public bool Default { get; set; } + + /// + /// Gets or sets a list of user models assigned to this role. + /// + public List Users { get; set; } = new List(); + + /// + /// Gets or sets the claims assigned to the role. + /// + /// The claims assigned to the role. + public Dictionary Claims { get; set; } = new Dictionary(); + } +} \ No newline at end of file diff --git a/src/Security/UserModel.cs b/src/Security/UserModel.cs new file mode 100644 index 0000000..5f374fb --- /dev/null +++ b/src/Security/UserModel.cs @@ -0,0 +1,74 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Security +{ + using System; + using System.Collections.Generic; + + /// + /// This class represents a security user within the application. + /// + public class UserModel : MinimalUserModel + { + /// + /// Gets or sets the date time when the account was created. + /// + public DateTime CreatedDate { get; set; } + + /// + /// Gets or sets the user model for the creator user. + /// + public MinimalUserModel CreatedBy { get; set; } + + /// + /// Gets or sets the date time when the account was last updated. + /// + public DateTime? UpdatedDate { get; set; } + + /// + /// Gets or sets the user model for the updating user. + /// + public MinimalUserModel UpdatedBy { get; set; } + + /// + /// Gets or sets the user notes. + /// + public string Notes { get; set; } + + /// + /// Gets or sets a value indicating whether the user account is active. + /// + public bool Active { get; set; } + + /// + /// Gets or sets a value indicating whether the user can be deleted. Typically set to true if the user model matches the current user. The current user + /// cannot delete themselves. + /// + public bool Deletable { get; set; } + + /// + /// Gets or sets a list of associated roles. + /// + public List Roles { get; set; } = new List(); + + /// + /// Gets or sets the claims. + /// + /// The claims. + public Dictionary Claims { get; set; } = new Dictionary(); + } +} \ No newline at end of file diff --git a/src/Shared/CreatedUpdaterModelBase.cs b/src/Shared/CreatedUpdaterModelBase.cs new file mode 100644 index 0000000..feb78c7 --- /dev/null +++ b/src/Shared/CreatedUpdaterModelBase.cs @@ -0,0 +1,47 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Shared +{ + using System; + using Talegen.Common.Models.Security; + + /// + /// This class contains basic created and updater properties for model records. + /// + public abstract class CreatedUpdaterModelBase + { + /// + /// Gets or sets the record created date time. + /// + public DateTime CreatedDate { get; set; } + + /// + /// Gets or sets the record creator model object. + /// + public MicroUserModel CreatedBy { get; set; } + + /// + /// Gets or sets the record last updated date time. + /// + public DateTime? UpdatedDate { get; set; } + + /// + /// Gets or sets the record updater model object. + /// + public MicroUserModel UpdatedBy { get; set; } + } +} \ No newline at end of file diff --git a/src/Shared/DeleteResultModelBase.cs b/src/Shared/DeleteResultModelBase.cs new file mode 100644 index 0000000..483d275 --- /dev/null +++ b/src/Shared/DeleteResultModelBase.cs @@ -0,0 +1,34 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Shared +{ + /// + /// This abstract class defines common model properties to return during a delete action within the application. + /// + public abstract class DeleteResultModelBase + { + /// + /// Gets or sets the identity of the record that was deleted. + /// + public long Id { get; set; } + + /// + /// Gets or sets a value indicating whether the value was successful. + /// + public bool Successful { get; set; } + } +} \ No newline at end of file diff --git a/src/Shared/DisplayValuePair.cs b/src/Shared/DisplayValuePair.cs new file mode 100644 index 0000000..f0372d6 --- /dev/null +++ b/src/Shared/DisplayValuePair.cs @@ -0,0 +1,36 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Shared +{ + /// + /// This class represents a base for displaying a name value pair combination. + /// + /// Contains the display data type. + /// Contains the value data type. + public abstract class DisplayValuePair + { + /// + /// Gets or sets the pair display value. + /// + public TDisplay Display { get; set; } + + /// + /// Gets or sets the pair value. + /// + public TValue Value { get; set; } + } +} \ No newline at end of file diff --git a/src/Shared/ErrorModel.cs b/src/Shared/ErrorModel.cs new file mode 100644 index 0000000..44099e1 --- /dev/null +++ b/src/Shared/ErrorModel.cs @@ -0,0 +1,87 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Shared +{ + using System; + using Talegen.Common.Core.Errors; + + /// + /// This class represents an error message within the class. + /// + public class ErrorModel : IErrorMessage + { + /// + /// Initializes a new instance of the class. + /// + public ErrorModel() + : this(string.Empty, ErrorType.Warning, DateTime.UtcNow, string.Empty) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Contains the error message text. + /// Contains the error message type. + /// Contains the date time when the error was created. + /// Contains an error stack trace message. + /// Contains the property name for validation errors. + public ErrorModel(string message, ErrorType type, DateTime eventDate, string stackTrace, string propertyName = "") + { + this.Message = message; + this.ErrorType = type; + this.PropertyName = propertyName; + this.StackTrace = stackTrace; + this.EventDate = eventDate; + } + + /// + /// Gets or sets the message error type. + /// + public ErrorCategory ErrorCategory { get; set; } + + /// + /// Gets or sets a suggested error code. + /// + public int SuggestedErrorCode { get; set; } + + /// + /// Gets or sets the error message type. + /// + public ErrorType ErrorType { get; set; } + + /// + /// Gets or sets the error message text. + /// + public string Message { get; set; } + + /// + /// Gets or sets a related property name. + /// + public string PropertyName { get; set; } + + /// + /// Gets or sets the date time when the error was generated. + /// + public DateTime EventDate { get; set; } + + /// + /// Gets or sets the error stack trace generated if any. + /// + public string StackTrace { get; set; } + } +} \ No newline at end of file diff --git a/src/Shared/ErrorResponseModel.cs b/src/Shared/ErrorResponseModel.cs new file mode 100644 index 0000000..fc706c3 --- /dev/null +++ b/src/Shared/ErrorResponseModel.cs @@ -0,0 +1,42 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Shared +{ + using System.Collections.Generic; + + /// + /// This class is used as the Error Response Model from an application. + /// + public class ErrorResponseModel + { + /// + /// Gets the error messages. + /// + public List Messages { get; } = new List(); + + /// + /// Gets or sets the failed ids. + /// + public List FailedIds { get; set; } = new List(); + + /// + /// Gets or sets a value indicating whether this instance has unhandled exception. + /// + /// true if this instance has unhandled exception; otherwise, false. + public bool HasUnhandledException { get; set; } + } +} \ No newline at end of file diff --git a/src/Shared/LanguageModel.cs b/src/Shared/LanguageModel.cs new file mode 100644 index 0000000..1b948a5 --- /dev/null +++ b/src/Shared/LanguageModel.cs @@ -0,0 +1,34 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Shared +{ + /// + /// This class represents a supported language definition within an application. + /// + public class LanguageModel : MinimalLanguageModel + { + /// + /// Gets or sets a value indicating whether if the language is the default for identity server. + /// + public bool Default { get; set; } + + /// + /// Gets or sets a value indicating whether if the language is active and available. + /// + public bool Active { get; set; } + } +} \ No newline at end of file diff --git a/src/Shared/MicroCreatedUpdaterModelBase.cs b/src/Shared/MicroCreatedUpdaterModelBase.cs new file mode 100644 index 0000000..2883015 --- /dev/null +++ b/src/Shared/MicroCreatedUpdaterModelBase.cs @@ -0,0 +1,47 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Shared +{ + using System; + using Talegen.Common.Models.Security; + + /// + /// This class contains basic created and updater properties for model records. + /// + public abstract class MicroCreatedUpdaterModelBase + { + /// + /// Gets or sets the record created date time. + /// + public DateTime CreatedDate { get; set; } + + /// + /// Gets or sets the record creator model object. + /// + public MicroUserModel CreatedBy { get; set; } + + /// + /// Gets or sets the record last updated date time. + /// + public DateTime? UpdatedDate { get; set; } + + /// + /// Gets or sets the record updater model object. + /// + public MicroUserModel UpdatedBy { get; set; } + } +} \ No newline at end of file diff --git a/src/Shared/MinimalLanguageModel.cs b/src/Shared/MinimalLanguageModel.cs new file mode 100644 index 0000000..9b043d8 --- /dev/null +++ b/src/Shared/MinimalLanguageModel.cs @@ -0,0 +1,45 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Shared +{ + using System.ComponentModel.DataAnnotations; + + /// + /// This class represents a minimal representation of a language within an application. + /// + public class MinimalLanguageModel + { + /// + /// Gets or sets the unique language locale code. + /// + [Required] + [MaxLength(5)] + public string LanguageCode { get; set; } + + /// + /// Gets or sets the name of the language. + /// + [Required] + public string Name { get; set; } + + /// + /// Gets or sets a value indicating whether [available locale]. + /// + /// true if [available locale]; otherwise, false. + public bool AvailableLocale { get; set; } + } +} \ No newline at end of file diff --git a/src/Shared/MinimalTimeZoneModel.cs b/src/Shared/MinimalTimeZoneModel.cs new file mode 100644 index 0000000..72a87d1 --- /dev/null +++ b/src/Shared/MinimalTimeZoneModel.cs @@ -0,0 +1,38 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Shared +{ + using System.ComponentModel.DataAnnotations; + + /// + /// This class represents a minimal set of time zone model information for an application. + /// + public class MinimalTimeZoneModel + { + /// + /// Gets or sets the time zone identity value. + /// + [MaxLength(100)] + public string TimeZoneId { get; set; } + + /// + /// Gets or sets the time zone short name. + /// + [MaxLength(200)] + public string ShortName { get; set; } + } +} \ No newline at end of file diff --git a/src/Shared/Queries/PaginatedQueryRequestModel.cs b/src/Shared/Queries/PaginatedQueryRequestModel.cs new file mode 100644 index 0000000..07e3105 --- /dev/null +++ b/src/Shared/Queries/PaginatedQueryRequestModel.cs @@ -0,0 +1,86 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Shared.Queries +{ + using System; + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + + /// + /// Contains an enumerated list of sort directions. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SortDirection + { + /// + /// Ascending sort. + /// + Ascending, + + /// + /// Descending sort. + /// + Descending + } + + /// + /// This class contains parameters passed to the query for filtering. + /// + public class PaginatedQueryRequestModel + { + /// + /// Initializes a new instance of the class. + /// + public PaginatedQueryRequestModel() + : this(25) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Contains the maximum page size. + /// Contains an optional current page number. + public PaginatedQueryRequestModel(int maxPageSize, int currentPage = 1) + { + this.Page = currentPage; + this.Limit = maxPageSize; + this.Sort = Array.Empty(); + this.Dir = Array.Empty(); + } + + /// + /// Gets or sets current page number. + /// + public int Page { get; set; } + + /// + /// Gets or sets the result limit. + /// + public int Limit { get; set; } + + /// + /// Gets or sets the name of the column to sort by. + /// + public string[] Sort { get; set; } + + /// + /// Gets or sets the sort direction. + /// + public SortDirection[] Dir { get; set; } + } +} \ No newline at end of file diff --git a/src/Shared/Queries/PaginatedQueryResultModel.cs b/src/Shared/Queries/PaginatedQueryResultModel.cs new file mode 100644 index 0000000..bdcaf9a --- /dev/null +++ b/src/Shared/Queries/PaginatedQueryResultModel.cs @@ -0,0 +1,40 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Shared.Queries +{ + using System.Collections.Generic; + + /// + /// This class defines the basic query result model for the paginated query. + /// + /// The type of the query result. + public class PaginatedQueryResultModel + where TQueryModel : class + { + /// + /// Gets or sets the total records. + /// + /// The total records. + public int TotalCount { get; set; } + + /// + /// Gets or sets the results of the model query. + /// + /// The results. + public List Results { get; set; } + } +} \ No newline at end of file diff --git a/src/Shared/TenantDetailModel.cs b/src/Shared/TenantDetailModel.cs new file mode 100644 index 0000000..d75c5f1 --- /dev/null +++ b/src/Shared/TenantDetailModel.cs @@ -0,0 +1,64 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Vasont.Publisher.Models.Common +{ + /// + /// This class represents the basic tenant information needed for the web application. + /// + public class TenantDetailModel + { + /// + /// Gets or sets the domain key. + /// + public string DomainKey { get; set; } + + /// + /// Gets or sets the tenant name. + /// + public string Name { get; set; } + + /// + /// Gets or sets the support information about the Tenant. + /// + public string SupportInfo { get; set; } + + /// + /// Gets or sets the support contact e-mail address for the Tenant. + /// + public string SupportEmail { get; set; } + + /// + /// Gets or sets the default language to use for the tenant application. + /// + public string DefaultLanguage { get; set; } + + /// + /// Gets or sets the server's session timeout in minutes. + /// + public int SessionTimeout { get; set; } + + /// + /// Gets or sets the copyright of the tenant application. + /// + public string Copyright { get; set; } + + /// + /// Gets or sets the version of the tenant application. + /// + public string Version { get; set; } + } +} \ No newline at end of file diff --git a/src/Shared/TimeZoneModel.cs b/src/Shared/TimeZoneModel.cs new file mode 100644 index 0000000..076fd4f --- /dev/null +++ b/src/Shared/TimeZoneModel.cs @@ -0,0 +1,49 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Shared +{ + using System.ComponentModel.DataAnnotations; + + /// + /// This class represents a timezone model within an application. + /// + /// + public class TimeZoneModel : MinimalTimeZoneModel + { + /// + /// Gets or sets the long name of the time zone. + /// + [MaxLength(300)] + public string LongName { get; set; } + + /// + /// Gets or sets the numeric time offset. + /// + [Required] + public double Offset { get; set; } + + /// + /// Gets or sets a value indicating whether if this is the default time zone. + /// + public bool Default { get; set; } + + /// + /// Gets or sets a value indicating whether the time zone is active. + /// + public bool Active { get; set; } + } +} \ No newline at end of file diff --git a/src/Talegen.Common.Models.csproj b/src/Talegen.Common.Models.csproj index 3a7368f..04539e1 100644 --- a/src/Talegen.Common.Models.csproj +++ b/src/Talegen.Common.Models.csproj @@ -12,14 +12,22 @@ logo.png https://github.com/Talegen/Talegen.Common.Models git - CRM - Initial code release + Models + Added additional shared models to be used across applications. Assets\logo.ico false + 1.0.1.0 + en + + + + D:\Projects\Talegen\GitHub\Talegen.Common.Models\src\Talegen.Common.Models.xml + + diff --git a/src/Talegen.Common.Models.xml b/src/Talegen.Common.Models.xml new file mode 100644 index 0000000..39de743 --- /dev/null +++ b/src/Talegen.Common.Models.xml @@ -0,0 +1,1280 @@ + + + + Talegen.Common.Models + + + + + Contains a static set of common default values. + + + + + The default language code. English. + + + + + The default time zone offset. + + + + + Available common titles. + + + + + Contains an enumerated list of address types. + + + + + A home address. + + + + + A work address. + + + + + A business address. + + + + + Other type of address. + + + + + Contains an enumerated list of commerce address types + + + + + The billing address. + + + + + The mailing address. + + + + + This class represents the basic postal address for an entity. + + + + + Gets or sets the primary address street. + + The primary address street. + + + + Gets or sets the secondary address street. + + The secondary address street. + + + + Gets or sets the address city. + + The address city. + + + + Gets or sets the address state/region. + + The state of the address state/region. + + + + Gets or sets the address postal/zip code. + + The state of the address postal/zip code. + + + + Gets or sets the address country. + + The address country. + + + + Gets or sets the type. + + The type. + + + + Gets or sets the type of the commerce. + + The type of the commerce. + + + + Gets or sets a value indicating whether this is primary. + + true if primary; otherwise, false. + + + + This class represents a contact record. + + + + + Gets or sets the identifier. + + The identifier. + + + + Gets or sets the name of the primary contact name. + + The name of the primary contact name. + + + + Gets or sets the company. + + The company. + + + + Gets or sets the phone numbers. + + The phone numbers. + + + + Gets or sets the email addresses. + + The email addresses. + + + + Gets or sets the job title. + + The job title. + + + + Gets or sets the website. + + The website. + + + + Gets or sets the instant messenger. + + The instant messenger. + + + + Gets or sets the notes. + + The notes. + + + + Gets or sets a value indicating whether this is primary. + + true if primary; otherwise, false. + + + + This class represents a minimum company contact record. + + + + + Gets or sets the identifier. + + The identifier. + + + + Gets or sets the name. + + The name. + + + + Gets or sets the website. + + The website. + + + + Gets or sets the phone. + + The phone. + + + + Gets or sets the email. + + The email. + + + + Gets or sets the location. + + The location. + + + + Gets or sets a value indicating whether this is primary. + + true if primary; otherwise, false. + + + + Contains an enumerated list of gender types. + + + + + No gender specified. + + + + + Male gender. + + + + + Female gender. + + + + + Non-biological identity. + + + + + Contains an extended set of contact details. + + + + + + Gets or sets the customer identifier. + + The customer identifier. + + + + Gets or sets the nickname. + + The nickname. + + + + Gets or sets the office. + + The office. + + + + Gets or sets the profession. + + The profession. + + + + Gets or sets the name of the manager. + + The name of the manager. + + + + Gets or sets the name of the assistant. + + The name of the assistant. + + + + Gets or sets the name of the spouse partner. + + The name of the spouse partner. + + + + Gets or sets the children. + + The children. + + + + Gets or sets the birthday. + + The birthday. + + + + Gets or sets the anniversary. + + The anniversary. + + + + Gets or sets the gender. + + The gender. + + + + Gets or sets the language. + + The language. + + + + Gets or sets the time zone. + + The time zone. + + + + Gets or sets the tags. + + The tags. + + + + This class implements the minimum properties for a contact name. + + + + + Gets or sets the name of the sir. + + The name of the sir. + + + + Gets or sets the first name. + + The first name. + + + + Gets or sets the name of the middle. + + The name of the middle. + + + + Gets or sets the last name. + + The last name. + + + + Gets or sets the suffix title of the name name. + + The suffix title of the name. + + + + Gets or sets the display name. + + The display name. + + + + Gets or sets a value indicating whether this is primary. + + true if primary; otherwise, false. + + + + Contains an enumerated list of phone types. + + + + + Personal e-mail address + + + + + Work e-mail address + + + + + Support contact e-mail address + + + + + Other e-mail address + + + + + This class represents a contact e-mail address. + + + + + Gets or sets the name. + + The name. + + + + Gets or sets the email address. + + The email address. + + + + Gets or sets the type. + + The type. + + + + Converts to string. + + A that represents this instance. + + + + This class represents the bare minimum of a geographic location. + + + + + Gets or sets the latitude. + + The latitude. + + + + Gets or sets the longitude. + + The longitude. + + + + This interface defines the minimum implementation of a geographic location class. + + + + + Gets or sets the latitude. + + The latitude. + + + + Gets or sets the longitude. + + The longitude. + + + + This class represents an address location with associated geographical information and identity. + + + + + + + Gets or sets the identifier. + + The identifier. + + + + Gets or sets the latitude. + + The latitude. + + + + Gets or sets the longitude. + + The longitude. + + + + Contains an enumerated list of phone types. + + + + + Personal phone number + + + + + Mobile phone number + + + + + Work phone number + + + + + A fax number. + + + + + Other phone number + + + + + This class represents a minimum definition of a phone number. + + + + + Gets or sets the country code. + + The country code. + + + + Gets or sets the number. + + The number. + + + + Gets or sets the extension. + + The extension. + + + + Gets or sets the type. + + The type. + + + + Contains a minimal definition of a category. + + + + + Gets or sets the identifier. + + The identifier. + + + + Gets or sets the parent identifier. + + The parent identifier. + + + + Gets or sets the name. + + The name. + + + + Gets or sets the description. + + The description. + + + + Gets or sets a value indicating whether this is primary. + + true if primary; otherwise, false. + + + + This class represents a tag + + + + + Gets or sets the identifier. + + The identifier. + + + + Gets or sets the tag. + + The tag. + + + + This class contains the bare minimum properties to represent a role in the interface. + + + + + Gets or sets the role identifier. + + The role identifier. + + + + Gets or sets the name. + + The name. + + + + This class contains the bare minimum properties to represent a user in the interface. + + + + + Gets or sets the unique identity of the user. + + + + + Gets or sets the user's e-mail address. + + + + + Gets or sets the first name. + + The first name. + + + + Gets or sets the last name. + + The last name. + + + + Gets the user full name. + + + + + Gets or sets the user name of the user. + + + + + Contains an enumerated list of role types. + + + + + System Roles Cannot be Deleted. + + + + + User Defined Roles. + + + + + This class represents a minimal representation of a security role. + + + + + Gets or sets the role description. + + + + + Gets or sets the type of the role. + + The type of the role. + + + + Gets or sets a value indicating whether the role is a system role and cannot be deleted. + + + + + This class represents a user that is assigned to a role. It is a stripped down version of the user and returns only essential information related to the + user for role associations. + + + + + Gets or sets the user's desired language. + + + + + Gets or sets the user's time zone. + + + + + Gets a value indicating whether the user is locked. + + + + + Gets or sets the lock expiration date. + + + + + This class defines the administration role query filter model. + + + + + + Gets or sets the search text. + + The search text. + + + + This class defines the administration user query filter model. + + + + + + Gets or sets the search text. + + The search text. + + + + Gets or sets a value indicating whether the search filter should show only active users. + + true if only active; otherwise, false and return all users. + + + + This model class represents a security role within the application. + + + + + Gets or sets the record created date time. + + + + + Gets or sets the user model for the creating user. + + + + + Gets or sets the record last updated date time. + + + + + Gets or sets the user model for the updating user. + + + + + Gets or sets a value indicating whether the role is automatically added to users when they are synchronized via the application subscription Redis channel. + + + + + Gets or sets a list of user models assigned to this role. + + + + + Gets or sets the claims assigned to the role. + + The claims assigned to the role. + + + + This class represents a security user within the application. + + + + + Gets or sets the date time when the account was created. + + + + + Gets or sets the user model for the creator user. + + + + + Gets or sets the date time when the account was last updated. + + + + + Gets or sets the user model for the updating user. + + + + + Gets or sets the user notes. + + + + + Gets or sets a value indicating whether the user account is active. + + + + + Gets or sets a value indicating whether the user can be deleted. Typically set to true if the user model matches the current user. The current user + cannot delete themselves. + + + + + Gets or sets a list of associated roles. + + + + + Gets or sets the claims. + + The claims. + + + + This abstract class defines common model properties to return during a delete action within the application. + + + + + Gets or sets the identity of the record that was deleted. + + + + + Gets or sets a value indicating whether the value was successful. + + + + + This class represents a base for displaying a name value pair combination. + + Contains the display data type. + Contains the value data type. + + + + Gets or sets the pair display value. + + + + + Gets or sets the pair value. + + + + + This class represents an error message within the class. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Contains the error message text. + Contains the error message type. + Contains the date time when the error was created. + Contains an error stack trace message. + Contains the property name for validation errors. + + + + Gets or sets the message error type. + + + + + Gets or sets a suggested error code. + + + + + Gets or sets the error message type. + + + + + Gets or sets the error message text. + + + + + Gets or sets a related property name. + + + + + Gets or sets the date time when the error was generated. + + + + + Gets or sets the error stack trace generated if any. + + + + + This class is used as the Error Response Model from an application. + + + + + Gets the error messages. + + + + + Gets or sets the failed ids. + + + + + Gets or sets a value indicating whether this instance has unhandled exception. + + true if this instance has unhandled exception; otherwise, false. + + + + This class represents a supported language definition within an application. + + + + + Gets or sets a value indicating whether if the language is the default for identity server. + + + + + Gets or sets a value indicating whether if the language is active and available. + + + + + This class contains basic created and updater properties for model records. + + + + + Gets or sets the record created date time. + + + + + Gets or sets the record creator model object. + + + + + Gets or sets the record last updated date time. + + + + + Gets or sets the record updater model object. + + + + + This class represents a minimal representation of a language within an application. + + + + + Gets or sets the unique language locale code. + + + + + Gets or sets the name of the language. + + + + + Gets or sets a value indicating whether [available locale]. + + true if [available locale]; otherwise, false. + + + + This class represents a minimal set of time zone model information for an application. + + + + + Gets or sets the time zone identity value. + + + + + Gets or sets the time zone short name. + + + + + Contains an enumerated list of sort directions. + + + + + Ascending sort. + + + + + Descending sort. + + + + + This class contains parameters passed to the query for filtering. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Contains the maximum page size. + Contains an optional current page number. + + + + Gets or sets current page number. + + + + + Gets or sets the result limit. + + + + + Gets or sets the name of the column to sort by. + + + + + Gets or sets the sort direction. + + + + + This class defines the basic query result model for the paginated query. + + The type of the query result. + + + + Gets or sets the total records. + + The total records. + + + + Gets or sets the results of the model query. + + The results. + + + + This class represents a timezone model within an application. + + + + + + Gets or sets the long name of the time zone. + + + + + Gets or sets the numeric time offset. + + + + + Gets or sets a value indicating whether if this is the default time zone. + + + + + Gets or sets a value indicating whether the time zone is active. + + + + + This class represents a date range of a start date time and end date time. + + + + + + Gets or sets the start date. + + The start date. + + + + Gets or sets the end date. + + The end date. + + + + Includes the specified value. + + The value. + + + + + + Includes the specified range. + + The range. + + + + + + This interface class is used to implement a range class. + + Contains the type of data for the range. + + + + Gets or sets the start. + + The start. + + + + Gets or sets the end. + + The end. + + + + Includes the specified value. + + The value. + + + + + Includes the specified range. + + The range. + + + + + This class contains basic created and updater properties for model records. + + + + + Gets or sets the record created date time. + + + + + Gets or sets the record creator model object. + + + + + Gets or sets the record last updated date time. + + + + + Gets or sets the record updater model object. + + + + + This class represents the basic tenant information needed for the web application. + + + + + Gets or sets the domain key. + + + + + Gets or sets the tenant name. + + + + + Gets or sets the support information about the Tenant. + + + + + Gets or sets the support contact e-mail address for the Tenant. + + + + + Gets or sets the default language to use for the tenant application. + + + + + Gets or sets the server's session timeout in minutes. + + + + + Gets or sets the copyright of the tenant application. + + + + + Gets or sets the version of the tenant application. + + + +