public static string GetEndpointTextForDeleteRecord(Entity entity, bool addSwaggerComments, Feature feature)
        {
            var lowercasePrimaryKey           = Entity.PrimaryKeyProperty.Name.LowercaseFirstLetter();
            var entityName                    = entity.Name;
            var primaryKeyProp                = Entity.PrimaryKeyProperty;
            var deleteRecordCommandMethodName = Utilities.CommandDeleteName(entityName);
            var pkPropertyType                = primaryKeyProp.Type;
            var deleteRecordAuthorizations    = feature.IsProtected ? EndpointSwaggerCommentBuilders.BuildAuthorizations(feature.PermissionName) : "";

            return(@$ "{EndpointSwaggerCommentBuilders.GetSwaggerComments_DeleteRecord(entity, addSwaggerComments, deleteRecordAuthorizations.Length > 0)}{deleteRecordAuthorizations}
예제 #2
0
        public static string GetEndpointTextForDeleteRecord(Entity entity, bool addSwaggerComments, List <Policy> policies)
        {
            var lowercasePrimaryKey           = Entity.PrimaryKeyProperty.Name.LowercaseFirstLetter();
            var entityName                    = entity.Name;
            var primaryKeyProp                = Entity.PrimaryKeyProperty;
            var deleteRecordCommandMethodName = Utilities.CommandDeleteName(entityName);
            var pkPropertyType                = primaryKeyProp.Type;
            var deleteRecordAuthorizations    = EndpointSwaggerCommentBuilders.BuildAuthorizations(policies);

            return(@$ "{EndpointSwaggerCommentBuilders.GetSwaggerComments_DeleteRecord(entity, addSwaggerComments, deleteRecordAuthorizations.Length > 0)}{deleteRecordAuthorizations}
예제 #3
0
        public static string GetEndpointTextForPatchRecord(Entity entity, bool addSwaggerComments, List <Policy> policies)
        {
            var lowercasePrimaryKey          = Entity.PrimaryKeyProperty.Name.LowercaseFirstLetter();
            var entityName                   = entity.Name;
            var updateDto                    = Utilities.GetDtoName(entityName, Dto.Update);
            var primaryKeyProp               = Entity.PrimaryKeyProperty;
            var patchRecordCommandMethodName = Utilities.CommandPatchName(entityName);
            var pkPropertyType               = primaryKeyProp.Type;
            var updatePartialAuthorizations  = EndpointSwaggerCommentBuilders.BuildAuthorizations(policies);

            return(@$ "{EndpointSwaggerCommentBuilders.GetSwaggerComments_PatchRecord(entity, addSwaggerComments, updatePartialAuthorizations.Length > 0)}{updatePartialAuthorizations}
예제 #4
0
        public static string GetEndpointTextForGetList(Entity entity, bool addSwaggerComments, Feature feature)
        {
            var lowercaseEntityVariable = entity.Name.LowercaseFirstLetter();
            var entityName           = entity.Name;
            var entityNamePlural     = entity.Plural;
            var readDto              = Utilities.GetDtoName(entityName, Dto.Read);
            var readParamDto         = Utilities.GetDtoName(entityName, Dto.ReadParamaters);
            var queryListMethodName  = Utilities.QueryListName(entityName);
            var listResponse         = $@"IEnumerable<{readDto}>";
            var getListEndpointName  = entity.Name == entity.Plural ? $@"Get{entityNamePlural}List" : $@"Get{entityNamePlural}";
            var getListAuthorization = feature.IsProtected ? EndpointSwaggerCommentBuilders.BuildAuthorizations(feature.PermissionName) : "";

            return(@$ "{EndpointSwaggerCommentBuilders.GetSwaggerComments_GetList(entity, addSwaggerComments, listResponse, getListAuthorization.Length > 0)}{getListAuthorization}
예제 #5
0
        public static string GetEndpointTextForCreateRecord(Entity entity, bool addSwaggerComments, List <Policy> policies)
        {
            var lowercaseEntityVariable = entity.Name.LowercaseFirstLetter();
            var entityName                 = entity.Name;
            var readDto                    = Utilities.GetDtoName(entityName, Dto.Read);
            var creationDto                = Utilities.GetDtoName(entityName, Dto.Creation);
            var primaryKeyProp             = Entity.PrimaryKeyProperty;
            var addRecordCommandMethodName = Utilities.CommandAddName(entityName);
            var singleResponse             = $@"{readDto}";
            var addRecordAuthorizations    = EndpointSwaggerCommentBuilders.BuildAuthorizations(policies);
            var creationPropName           = $"{lowercaseEntityVariable}ForCreation";

            return(@$ "{EndpointSwaggerCommentBuilders.GetSwaggerComments_CreateRecord(entity, addSwaggerComments, singleResponse, addRecordAuthorizations.Length > 0)}{addRecordAuthorizations}
        public static string GetEndpointTextForGetRecord(Entity entity, bool addSwaggerComments, Feature feature)
        {
            var lowercasePrimaryKey     = Entity.PrimaryKeyProperty.Name.LowercaseFirstLetter();
            var entityName              = entity.Name;
            var entityNamePlural        = entity.Plural;
            var readDto                 = Utilities.GetDtoName(entityName, Dto.Read);
            var primaryKeyProp          = Entity.PrimaryKeyProperty;
            var queryRecordMethodName   = Utilities.QueryRecordName(entityName);
            var pkPropertyType          = primaryKeyProp.Type;
            var singleResponse          = $@"{readDto}";
            var getRecordEndpointName   = entity.Name == entity.Plural ? $@"Get{entityNamePlural}Record" : $@"Get{entity.Name}";
            var getRecordAuthorizations = feature.IsProtected ? EndpointSwaggerCommentBuilders.BuildAuthorizations(feature.PermissionName) : "";


            return(@$ "{EndpointSwaggerCommentBuilders.GetSwaggerComments_GetRecord(entity, addSwaggerComments, singleResponse, getRecordAuthorizations.Length > 0)}{getRecordAuthorizations}