Merge branch 'dev' into j2/fix/refactor-routes
# Conflicts: # Webzine.WebApplication/Controllers/RechercheController.cs # Webzine.WebApplication/Views/Recherche/Index.cshtml
This commit is contained in:
500
.editorconfig
500
.editorconfig
@@ -1,64 +1,59 @@
|
||||
root = true
|
||||
|
||||
# All files
|
||||
# ============================================================
|
||||
# ALL FILES
|
||||
# ============================================================
|
||||
[*]
|
||||
indent_style = space
|
||||
|
||||
# Xml files
|
||||
# ============================================================
|
||||
# XML FILES
|
||||
# ============================================================
|
||||
[*.xml]
|
||||
indent_size = 2
|
||||
|
||||
# Xml project files
|
||||
[*.{csproj,fsproj,vbproj,proj,slnx}]
|
||||
indent_size = 2
|
||||
|
||||
# Xml config files
|
||||
[*.{props,targets,config,nuspec}]
|
||||
indent_size = 2
|
||||
|
||||
# ============================================================
|
||||
# JSON FILES
|
||||
# ============================================================
|
||||
[*.json]
|
||||
indent_size = 2
|
||||
|
||||
# C# files
|
||||
[*.cs]
|
||||
|
||||
#### Core EditorConfig Options ####
|
||||
|
||||
# Indentation and spacing
|
||||
indent_size = 4
|
||||
tab_width = 4
|
||||
|
||||
# New line preferences
|
||||
insert_final_newline = false
|
||||
|
||||
#### .NET Coding Conventions ####
|
||||
# ============================================================
|
||||
# C# AND VB FILES — SHARED .NET CONVENTIONS
|
||||
# ============================================================
|
||||
[*.{cs,vb}]
|
||||
|
||||
# Organize usings
|
||||
#### Organize Usings ####
|
||||
dotnet_separate_import_directive_groups = true
|
||||
dotnet_sort_system_directives_first = true
|
||||
file_header_template = unset
|
||||
|
||||
# this. and Me. preferences
|
||||
#### this. and Me. Preferences ####
|
||||
dotnet_style_qualification_for_event = false:silent
|
||||
dotnet_style_qualification_for_field = false:silent
|
||||
dotnet_style_qualification_for_method = false:silent
|
||||
dotnet_style_qualification_for_property = false:silent
|
||||
|
||||
# Language keywords vs BCL types preferences
|
||||
#### Language Keywords vs BCL Types ####
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
|
||||
dotnet_style_predefined_type_for_member_access = true:silent
|
||||
|
||||
# Parentheses preferences
|
||||
#### Parentheses Preferences ####
|
||||
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
|
||||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
|
||||
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
|
||||
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
|
||||
|
||||
# Modifier preferences
|
||||
#### Modifier Preferences ####
|
||||
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
|
||||
|
||||
# Expression-level preferences
|
||||
#### Expression-Level Preferences ####
|
||||
dotnet_style_coalesce_expression = true:suggestion
|
||||
dotnet_style_collection_initializer = true:suggestion
|
||||
dotnet_style_explicit_tuple_names = true:suggestion
|
||||
@@ -78,129 +73,30 @@ dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggesti
|
||||
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
|
||||
dotnet_style_prefer_simplified_interpolation = true:suggestion
|
||||
|
||||
# Field preferences
|
||||
#### Field Preferences ####
|
||||
dotnet_style_readonly_field = true:warning
|
||||
|
||||
# Parameter preferences
|
||||
#### Parameter Preferences ####
|
||||
dotnet_code_quality_unused_parameters = all:suggestion
|
||||
|
||||
# Suppression preferences
|
||||
#### Suppression Preferences ####
|
||||
dotnet_remove_unnecessary_suppression_exclusions = none
|
||||
|
||||
#### C# Coding Conventions ####
|
||||
[*.cs]
|
||||
#### Diagnostics ####
|
||||
dotnet_diagnostic.IDE0005.severity = warning # Remove unused usings
|
||||
dotnet_diagnostic.IDE0073.severity = none # File header not required
|
||||
dotnet_diagnostic.SA1600.severity = warning # Elements should be documented
|
||||
dotnet_diagnostic.SA1623.severity = none # Property summary text
|
||||
dotnet_diagnostic.SA1624.severity = none # Property summary text
|
||||
dotnet_diagnostic.SA1633.severity = none # File header not required
|
||||
dotnet_diagnostic.SA1642.severity = suggestion # Constructor summary text
|
||||
|
||||
# var preferences
|
||||
csharp_style_var_elsewhere = false:silent
|
||||
csharp_style_var_for_built_in_types = false:silent
|
||||
csharp_style_var_when_type_is_apparent = false:silent
|
||||
|
||||
# Expression-bodied members
|
||||
csharp_style_expression_bodied_accessors = true:silent
|
||||
csharp_style_expression_bodied_constructors = false:silent
|
||||
csharp_style_expression_bodied_indexers = true:silent
|
||||
csharp_style_expression_bodied_lambdas = true:suggestion
|
||||
csharp_style_expression_bodied_local_functions = false:silent
|
||||
csharp_style_expression_bodied_methods = false:silent
|
||||
csharp_style_expression_bodied_operators = false:silent
|
||||
csharp_style_expression_bodied_properties = true:silent
|
||||
|
||||
# Pattern matching preferences
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
|
||||
csharp_style_prefer_extended_property_pattern = true:suggestion
|
||||
csharp_style_prefer_not_pattern = true:suggestion
|
||||
csharp_style_prefer_pattern_matching = true:silent
|
||||
csharp_style_prefer_switch_expression = true:suggestion
|
||||
|
||||
# Null-checking preferences
|
||||
csharp_style_conditional_delegate_call = true:suggestion
|
||||
|
||||
# Modifier preferences
|
||||
csharp_prefer_static_anonymous_function = true:suggestion
|
||||
csharp_prefer_static_local_function = true:warning
|
||||
csharp_preferred_modifier_order = public,private,protected,internal,file,const,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion
|
||||
csharp_style_prefer_readonly_struct = true:suggestion
|
||||
csharp_style_prefer_readonly_struct_member = true:suggestion
|
||||
|
||||
# Code-block preferences
|
||||
csharp_prefer_braces = true:silent
|
||||
csharp_prefer_simple_using_statement = true:suggestion
|
||||
csharp_style_namespace_declarations = file_scoped:suggestion
|
||||
csharp_style_prefer_method_group_conversion = true:silent
|
||||
csharp_style_prefer_primary_constructors = true:suggestion
|
||||
csharp_style_prefer_top_level_statements = true:silent
|
||||
|
||||
# Expression-level preferences
|
||||
csharp_prefer_simple_default_expression = true:suggestion
|
||||
csharp_style_deconstructed_variable_declaration = true:suggestion
|
||||
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
|
||||
csharp_style_inlined_variable_declaration = true:suggestion
|
||||
csharp_style_prefer_index_operator = true:suggestion
|
||||
csharp_style_prefer_local_over_anonymous_function = true:suggestion
|
||||
csharp_style_prefer_null_check_over_type_check = true:suggestion
|
||||
csharp_style_prefer_range_operator = true:suggestion
|
||||
csharp_style_prefer_tuple_swap = true:suggestion
|
||||
csharp_style_prefer_utf8_string_literals = true:suggestion
|
||||
csharp_style_throw_expression = true:suggestion
|
||||
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
|
||||
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
|
||||
|
||||
# 'using' directive preferences
|
||||
csharp_using_directive_placement = outside_namespace:silent
|
||||
|
||||
#### C# Formatting Rules ####
|
||||
|
||||
# New line preferences
|
||||
csharp_new_line_before_catch = true
|
||||
csharp_new_line_before_else = true
|
||||
csharp_new_line_before_finally = true
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_open_brace = all
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
|
||||
# Indentation preferences
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_case_contents_when_block = true
|
||||
csharp_indent_labels = one_less_than_current
|
||||
csharp_indent_switch_labels = true
|
||||
|
||||
# Space preferences
|
||||
csharp_space_after_cast = false
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
csharp_space_after_comma = true
|
||||
csharp_space_after_dot = false
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
csharp_space_after_semicolon_in_for_statement = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_space_around_declaration_statements = false
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
csharp_space_before_comma = false
|
||||
csharp_space_before_dot = false
|
||||
csharp_space_before_open_square_brackets = false
|
||||
csharp_space_before_semicolon_in_for_statement = false
|
||||
csharp_space_between_empty_square_brackets = false
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
csharp_space_between_parentheses = false
|
||||
csharp_space_between_square_brackets = false
|
||||
|
||||
# Wrapping preferences
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = true
|
||||
|
||||
#### Naming styles ####
|
||||
# ============================================================
|
||||
# NAMING RULES
|
||||
# ============================================================
|
||||
[*.{cs,vb}]
|
||||
|
||||
# Naming rules
|
||||
|
||||
## Rules ##
|
||||
dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.symbols = types_and_namespaces
|
||||
dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.style = pascalcase
|
||||
@@ -225,6 +121,38 @@ dotnet_naming_rule.events_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.events_should_be_pascalcase.symbols = events
|
||||
dotnet_naming_rule.events_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.public_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.public_fields_should_be_pascalcase.symbols = public_fields
|
||||
dotnet_naming_rule.public_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.symbols = public_constant_fields
|
||||
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.symbols = public_static_readonly_fields
|
||||
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.private_fields_should_be__camelcase.severity = suggestion
|
||||
dotnet_naming_rule.private_fields_should_be__camelcase.symbols = private_fields
|
||||
dotnet_naming_rule.private_fields_should_be__camelcase.style = _camelcase
|
||||
|
||||
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.severity = suggestion
|
||||
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.symbols = private_static_fields
|
||||
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.style = s_camelcase
|
||||
|
||||
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.symbols = private_constant_fields
|
||||
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.symbols = private_static_readonly_fields
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.enums_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.enums_should_be_pascalcase.symbols = enums
|
||||
dotnet_naming_rule.enums_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.local_variables_should_be_camelcase.severity = suggestion
|
||||
dotnet_naming_rule.local_variables_should_be_camelcase.symbols = local_variables
|
||||
dotnet_naming_rule.local_variables_should_be_camelcase.style = camelcase
|
||||
@@ -237,38 +165,6 @@ dotnet_naming_rule.parameters_should_be_camelcase.severity = suggestion
|
||||
dotnet_naming_rule.parameters_should_be_camelcase.symbols = parameters
|
||||
dotnet_naming_rule.parameters_should_be_camelcase.style = camelcase
|
||||
|
||||
dotnet_naming_rule.public_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.public_fields_should_be_pascalcase.symbols = public_fields
|
||||
dotnet_naming_rule.public_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.private_fields_should_be__camelcase.severity = suggestion
|
||||
dotnet_naming_rule.private_fields_should_be__camelcase.symbols = private_fields
|
||||
dotnet_naming_rule.private_fields_should_be__camelcase.style = _camelcase
|
||||
|
||||
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.severity = suggestion
|
||||
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.symbols = private_static_fields
|
||||
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.style = s_camelcase
|
||||
|
||||
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.symbols = public_constant_fields
|
||||
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.symbols = private_constant_fields
|
||||
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.symbols = public_static_readonly_fields
|
||||
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.symbols = private_static_readonly_fields
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.enums_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.enums_should_be_pascalcase.symbols = enums
|
||||
dotnet_naming_rule.enums_should_be_pascalcase.style = pascalcase
|
||||
|
||||
dotnet_naming_rule.local_functions_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.local_functions_should_be_pascalcase.symbols = local_functions
|
||||
dotnet_naming_rule.local_functions_should_be_pascalcase.style = pascalcase
|
||||
@@ -277,67 +173,35 @@ dotnet_naming_rule.non_field_members_should_be_pascalcase.severity = suggestion
|
||||
dotnet_naming_rule.non_field_members_should_be_pascalcase.symbols = non_field_members
|
||||
dotnet_naming_rule.non_field_members_should_be_pascalcase.style = pascalcase
|
||||
|
||||
# Symbol specifications
|
||||
## Symbol Specifications ##
|
||||
dotnet_naming_symbols.types_and_namespaces.applicable_kinds = namespace, class, struct, interface, enum
|
||||
dotnet_naming_symbols.types_and_namespaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.types_and_namespaces.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.interfaces.applicable_kinds = interface
|
||||
dotnet_naming_symbols.interfaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.interfaces.required_modifiers =
|
||||
dotnet_naming_symbols.interfaces.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.enums.applicable_kinds = enum
|
||||
dotnet_naming_symbols.enums.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.enums.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.events.applicable_kinds = event
|
||||
dotnet_naming_symbols.events.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.events.required_modifiers =
|
||||
# NOTE: was previously misconfigured as 'namespace' kind — corrected to 'type_parameter'
|
||||
dotnet_naming_symbols.type_parameters.applicable_kinds = type_parameter
|
||||
dotnet_naming_symbols.type_parameters.applicable_accessibilities = *
|
||||
dotnet_naming_symbols.type_parameters.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.methods.applicable_kinds = method
|
||||
dotnet_naming_symbols.methods.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.methods.required_modifiers =
|
||||
dotnet_naming_symbols.methods.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.properties.applicable_kinds = property
|
||||
dotnet_naming_symbols.properties.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.properties.required_modifiers =
|
||||
dotnet_naming_symbols.properties.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.events.applicable_kinds = event
|
||||
dotnet_naming_symbols.events.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.events.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.public_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.public_fields.applicable_accessibilities = public, internal
|
||||
dotnet_naming_symbols.public_fields.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.private_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_fields.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.private_static_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_static_fields.required_modifiers = static
|
||||
|
||||
dotnet_naming_symbols.types_and_namespaces.applicable_kinds = namespace, class, struct, interface, enum
|
||||
dotnet_naming_symbols.types_and_namespaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.types_and_namespaces.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.type_parameters.applicable_kinds = namespace
|
||||
dotnet_naming_symbols.type_parameters.applicable_accessibilities = *
|
||||
dotnet_naming_symbols.type_parameters.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.private_constant_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_constant_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_constant_fields.required_modifiers = const
|
||||
|
||||
dotnet_naming_symbols.local_variables.applicable_kinds = local
|
||||
dotnet_naming_symbols.local_variables.applicable_accessibilities = local
|
||||
dotnet_naming_symbols.local_variables.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.local_constants.applicable_kinds = local
|
||||
dotnet_naming_symbols.local_constants.applicable_accessibilities = local
|
||||
dotnet_naming_symbols.local_constants.required_modifiers = const
|
||||
|
||||
dotnet_naming_symbols.parameters.applicable_kinds = parameter
|
||||
dotnet_naming_symbols.parameters.applicable_accessibilities = *
|
||||
dotnet_naming_symbols.parameters.required_modifiers =
|
||||
dotnet_naming_symbols.public_fields.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.public_constant_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.public_constant_fields.applicable_accessibilities = public, internal
|
||||
@@ -347,57 +211,193 @@ dotnet_naming_symbols.public_static_readonly_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.public_static_readonly_fields.applicable_accessibilities = public, internal
|
||||
dotnet_naming_symbols.public_static_readonly_fields.required_modifiers = readonly, static
|
||||
|
||||
dotnet_naming_symbols.private_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_fields.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.private_static_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_static_fields.required_modifiers = static
|
||||
|
||||
dotnet_naming_symbols.private_constant_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_constant_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_constant_fields.required_modifiers = const
|
||||
|
||||
dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = readonly, static
|
||||
|
||||
dotnet_naming_symbols.enums.applicable_kinds = enum
|
||||
dotnet_naming_symbols.enums.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.enums.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.local_variables.applicable_kinds = local
|
||||
dotnet_naming_symbols.local_variables.applicable_accessibilities = local
|
||||
dotnet_naming_symbols.local_variables.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.local_constants.applicable_kinds = local
|
||||
dotnet_naming_symbols.local_constants.applicable_accessibilities = local
|
||||
dotnet_naming_symbols.local_constants.required_modifiers = const
|
||||
|
||||
dotnet_naming_symbols.parameters.applicable_kinds = parameter
|
||||
dotnet_naming_symbols.parameters.applicable_accessibilities = *
|
||||
dotnet_naming_symbols.parameters.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
|
||||
dotnet_naming_symbols.local_functions.applicable_accessibilities = *
|
||||
dotnet_naming_symbols.local_functions.required_modifiers =
|
||||
dotnet_naming_symbols.local_functions.required_modifiers =
|
||||
|
||||
# Naming styles
|
||||
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||
|
||||
dotnet_naming_style.pascalcase.required_prefix =
|
||||
dotnet_naming_style.pascalcase.required_suffix =
|
||||
dotnet_naming_style.pascalcase.word_separator =
|
||||
## Naming Styles ##
|
||||
dotnet_naming_style.pascalcase.capitalization = pascal_case
|
||||
dotnet_naming_style.pascalcase.required_prefix =
|
||||
dotnet_naming_style.pascalcase.required_suffix =
|
||||
dotnet_naming_style.pascalcase.word_separator =
|
||||
|
||||
dotnet_naming_style.ipascalcase.required_prefix = I
|
||||
dotnet_naming_style.ipascalcase.required_suffix =
|
||||
dotnet_naming_style.ipascalcase.word_separator =
|
||||
dotnet_naming_style.ipascalcase.capitalization = pascal_case
|
||||
dotnet_naming_style.ipascalcase.required_prefix = I
|
||||
dotnet_naming_style.ipascalcase.required_suffix =
|
||||
dotnet_naming_style.ipascalcase.word_separator =
|
||||
|
||||
dotnet_naming_style.tpascalcase.required_prefix = T
|
||||
dotnet_naming_style.tpascalcase.required_suffix =
|
||||
dotnet_naming_style.tpascalcase.word_separator =
|
||||
dotnet_naming_style.tpascalcase.capitalization = pascal_case
|
||||
dotnet_naming_style.tpascalcase.required_prefix = T
|
||||
dotnet_naming_style.tpascalcase.required_suffix =
|
||||
dotnet_naming_style.tpascalcase.word_separator =
|
||||
|
||||
dotnet_naming_style._camelcase.required_prefix = _
|
||||
dotnet_naming_style._camelcase.required_suffix =
|
||||
dotnet_naming_style._camelcase.word_separator =
|
||||
dotnet_naming_style._camelcase.capitalization = camel_case
|
||||
|
||||
dotnet_naming_style.camelcase.required_prefix =
|
||||
dotnet_naming_style.camelcase.required_suffix =
|
||||
dotnet_naming_style.camelcase.word_separator =
|
||||
dotnet_naming_style.camelcase.capitalization = camel_case
|
||||
dotnet_naming_style.camelcase.required_prefix =
|
||||
dotnet_naming_style.camelcase.required_suffix =
|
||||
dotnet_naming_style.camelcase.word_separator =
|
||||
|
||||
dotnet_naming_style._camelcase.capitalization = camel_case
|
||||
dotnet_naming_style._camelcase.required_prefix = _
|
||||
dotnet_naming_style._camelcase.required_suffix =
|
||||
dotnet_naming_style._camelcase.word_separator =
|
||||
|
||||
dotnet_naming_style.s_camelcase.required_prefix = s_
|
||||
dotnet_naming_style.s_camelcase.required_suffix =
|
||||
dotnet_naming_style.s_camelcase.word_separator =
|
||||
dotnet_naming_style.s_camelcase.capitalization = camel_case
|
||||
dotnet_naming_style.s_camelcase.required_prefix = s_
|
||||
dotnet_naming_style.s_camelcase.required_suffix =
|
||||
dotnet_naming_style.s_camelcase.word_separator =
|
||||
|
||||
dotnet_diagnostic.SA1623.severity = none
|
||||
dotnet_diagnostic.SA1624.severity = none
|
||||
|
||||
dotnet_diagnostic.SA1600.severity = suggestion
|
||||
|
||||
# ============================================================
|
||||
# C# FILES ONLY
|
||||
# ============================================================
|
||||
[*.cs]
|
||||
# 1. Tell the .NET Formatter to stop injecting a header
|
||||
file_header_template = unset
|
||||
|
||||
# 2. Tell StyleCop to stop requiring a file header (SA1633)
|
||||
dotnet_diagnostic.SA1633.severity = none
|
||||
#### Core EditorConfig Options ####
|
||||
indent_size = 4
|
||||
tab_width = 4
|
||||
insert_final_newline = false
|
||||
|
||||
# 3. Tell the IDE to stop requiring a file header (IDE0073)
|
||||
dotnet_diagnostic.IDE0073.severity = none
|
||||
#### var Preferences ####
|
||||
csharp_style_var_elsewhere = false:silent
|
||||
csharp_style_var_for_built_in_types = false:silent
|
||||
csharp_style_var_when_type_is_apparent = false:silent
|
||||
|
||||
#### Expression-Bodied Members ####
|
||||
csharp_style_expression_bodied_accessors = true:silent
|
||||
csharp_style_expression_bodied_constructors = false:silent
|
||||
csharp_style_expression_bodied_indexers = true:silent
|
||||
csharp_style_expression_bodied_lambdas = true:suggestion
|
||||
csharp_style_expression_bodied_local_functions = false:silent
|
||||
csharp_style_expression_bodied_methods = false:silent
|
||||
csharp_style_expression_bodied_operators = false:silent
|
||||
csharp_style_expression_bodied_properties = true:silent
|
||||
|
||||
#### Pattern Matching Preferences ####
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
|
||||
csharp_style_prefer_extended_property_pattern = true:suggestion
|
||||
csharp_style_prefer_not_pattern = true:suggestion
|
||||
csharp_style_prefer_pattern_matching = true:silent
|
||||
csharp_style_prefer_switch_expression = true:suggestion
|
||||
|
||||
#### Null-Checking Preferences ####
|
||||
csharp_style_conditional_delegate_call = true:suggestion
|
||||
|
||||
#### Modifier Preferences ####
|
||||
csharp_prefer_static_anonymous_function = true:suggestion
|
||||
csharp_prefer_static_local_function = true:warning
|
||||
csharp_preferred_modifier_order = public,private,protected,internal,file,const,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion
|
||||
csharp_style_prefer_readonly_struct = true:suggestion
|
||||
csharp_style_prefer_readonly_struct_member = true:suggestion
|
||||
|
||||
#### Code-Block Preferences ####
|
||||
csharp_prefer_braces = true:silent
|
||||
csharp_prefer_simple_using_statement = true:suggestion
|
||||
csharp_style_namespace_declarations = file_scoped:suggestion
|
||||
csharp_style_prefer_method_group_conversion = true:silent
|
||||
csharp_style_prefer_primary_constructors = true:suggestion
|
||||
csharp_style_prefer_top_level_statements = true:silent
|
||||
|
||||
#### Expression-Level Preferences ####
|
||||
csharp_prefer_simple_default_expression = true:suggestion
|
||||
csharp_style_deconstructed_variable_declaration = true:suggestion
|
||||
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
|
||||
csharp_style_inlined_variable_declaration = true:suggestion
|
||||
csharp_style_prefer_index_operator = true:suggestion
|
||||
csharp_style_prefer_local_over_anonymous_function = true:suggestion
|
||||
csharp_style_prefer_null_check_over_type_check = true:suggestion
|
||||
csharp_style_prefer_range_operator = true:suggestion
|
||||
csharp_style_prefer_tuple_swap = true:suggestion
|
||||
csharp_style_prefer_utf8_string_literals = true:suggestion
|
||||
csharp_style_throw_expression = true:suggestion
|
||||
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
|
||||
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
|
||||
|
||||
#### Using Directive Preferences ####
|
||||
csharp_using_directive_placement = inside_namespace:warning
|
||||
|
||||
#### Formatting — New Line Preferences ####
|
||||
csharp_new_line_before_catch = true
|
||||
csharp_new_line_before_else = true
|
||||
csharp_new_line_before_finally = true
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_open_brace = all
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
|
||||
#### Formatting — Indentation Preferences ####
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_case_contents_when_block = true
|
||||
csharp_indent_labels = one_less_than_current
|
||||
csharp_indent_switch_labels = true
|
||||
|
||||
#### Formatting — Space Preferences ####
|
||||
csharp_space_after_cast = false
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
csharp_space_after_comma = true
|
||||
csharp_space_after_dot = false
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
csharp_space_after_semicolon_in_for_statement = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_space_around_declaration_statements = false
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
csharp_space_before_comma = false
|
||||
csharp_space_before_dot = false
|
||||
csharp_space_before_open_square_brackets = false
|
||||
csharp_space_before_semicolon_in_for_statement = false
|
||||
csharp_space_between_empty_square_brackets = false
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
csharp_space_between_parentheses = false
|
||||
csharp_space_between_square_brackets = false
|
||||
|
||||
#### Formatting — Wrapping Preferences ####
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = true
|
||||
|
||||
# ============================================================
|
||||
# TEST PROJECTS — RELAXED RULES
|
||||
# ============================================================
|
||||
[*.Tests/**/*.cs]
|
||||
dotnet_diagnostic.SA1600.severity = none
|
||||
@@ -13,19 +13,29 @@ jobs:
|
||||
|
||||
- name: Configure appsettings for CI
|
||||
run: |
|
||||
# Find the appsettings.json file
|
||||
APPSETTINGS_PATH="Webzine.WebApplication/appsettings.json"
|
||||
|
||||
# Backup original file
|
||||
cp $APPSETTINGS_PATH $APPSETTINGS_PATH.bak
|
||||
|
||||
# Use jq to modify the JSON
|
||||
jq '.UseDatabase = true | .IsSQLite = true' $APPSETTINGS_PATH > $APPSETTINGS_PATH.tmp
|
||||
mv $APPSETTINGS_PATH.tmp $APPSETTINGS_PATH
|
||||
|
||||
echo "Updated appsettings.json:"
|
||||
cat $APPSETTINGS_PATH
|
||||
|
||||
- name: Cache .NET SDK
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.dotnet
|
||||
/usr/share/dotnet
|
||||
key: ${{ runner.os }}-dotnet-10.0.x
|
||||
|
||||
- name: Cache NuGet packages
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.sln') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nuget-
|
||||
|
||||
- name: Setup .NET 10
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
@@ -65,24 +75,22 @@ jobs:
|
||||
chmod +x scripts/test-endpoints.sh
|
||||
bash scripts/test-endpoints.sh http://localhost:5038 1000 2>&1 | tee /tmp/webzine_endpoint_output.txt
|
||||
EXIT_CODE=${PIPESTATUS[0]}
|
||||
|
||||
# Count failures
|
||||
|
||||
FAIL_COUNT=$(grep -cE "^\[ÉCHEC\]" /tmp/webzine_endpoint_output.txt 2>/dev/null || echo 0)
|
||||
SLOW_COUNT=$(grep -cE "^\[LENT\]" /tmp/webzine_endpoint_output.txt 2>/dev/null || echo 0)
|
||||
|
||||
|
||||
echo "failed=$FAIL_COUNT" >> "$GITHUB_OUTPUT"
|
||||
echo "slow=$SLOW_COUNT" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Échoue s’il y a DES problèmes (échecs OU lents)
|
||||
|
||||
if [ $FAIL_COUNT -gt 0 ] || [ $SLOW_COUNT -gt 0 ]; then
|
||||
echo "❌ Performance check failed: $FAIL_COUNT endpoint(s) failed, $SLOW_COUNT endpoint(s) exceeded threshold (1000ms)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
echo "✅ All endpoints passed performance check (< 1000ms)"
|
||||
|
||||
- name: Post performance report as PR comment
|
||||
if: always() # Always post comment, even on failure
|
||||
if: always()
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
GITEA_SERVER_URL: ${{ gitea.server_url }}
|
||||
@@ -92,20 +100,15 @@ jobs:
|
||||
RAW_REPORT=$(cat /tmp/webzine_endpoint_output.txt 2>/dev/null || echo "Aucune sortie capturée.")
|
||||
FAILED_COUNT="${{ steps.perf_test.outputs.failed }}"
|
||||
SLOW_COUNT="${{ steps.perf_test.outputs.slow }}"
|
||||
|
||||
# Determine if the check passed or failed
|
||||
|
||||
if [ "$FAILED_COUNT" -gt 0 ] || [ "$SLOW_COUNT" -gt 0 ]; then
|
||||
STATUS_HEADER="❌ **PERFORMANCE CHECK FAILED**"
|
||||
STATUS_ICON="❌"
|
||||
else
|
||||
STATUS_HEADER="✅ **PERFORMANCE CHECK PASSED**"
|
||||
STATUS_ICON="✅"
|
||||
fi
|
||||
|
||||
# Convert report to Markdown with colors
|
||||
|
||||
CLEAN_REPORT=$(echo "$RAW_REPORT" | sed 's/\x1b\[[0-9;]*m//g')
|
||||
|
||||
# Generate formatted report
|
||||
|
||||
FORMATTED_REPORT=$(echo "$CLEAN_REPORT" | sed \
|
||||
-e 's/^\[OK\] /✅ /' \
|
||||
-e 's/^\[LENT\] /⚠️ /' \
|
||||
@@ -120,23 +123,16 @@ jobs:
|
||||
-e 's/^\(⚠️ ENDPOINTS LENTS.*\)$/\n### \1/' \
|
||||
-e 's/^\(❌ ENDPOINTS EN ÉCHEC.*\)$/\n### \1/' \
|
||||
-e 's/^\(La PR doit.*\)$/\n**❌ \1**/')
|
||||
|
||||
|
||||
BODY=$(cat <<EOF
|
||||
$STATUS_HEADER
|
||||
|
||||
|
||||
$FORMATTED_REPORT
|
||||
|
||||
---
|
||||
**Seuil**: 1000ms
|
||||
**Statistiques**:
|
||||
- ✅ Endpoints rapides: \$(grep -c "^\[OK\]" /tmp/webzine_endpoint_output.txt 2>/dev/null || echo 0)
|
||||
- ⚠️ Endpoints lents (>1000ms): $SLOW_COUNT
|
||||
- ❌ Endpoints en échec: $FAILED_COUNT
|
||||
|
||||
|
||||
**Vérifié par**: Workflow PR Endpoint Performance
|
||||
EOF
|
||||
)
|
||||
|
||||
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
|
||||
@@ -7,7 +7,7 @@ EXPOSE 8081
|
||||
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
COPY ["Webzine.WebApplication/Webzine.WebApplication.csproj", "Webzine.WebApplication/"]
|
||||
COPY ["./Webzine.WebApplication/Webzine.WebApplication.csproj", "Webzine.WebApplication/"]
|
||||
RUN dotnet restore "Webzine.WebApplication/Webzine.WebApplication.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/Webzine.WebApplication"
|
||||
@@ -8,9 +8,10 @@
|
||||
|
||||
## Table des modifications
|
||||
|
||||
| Date | Auteur |
|
||||
|------|--------|
|
||||
| Date | Auteur |
|
||||
| ----- | ------------- |
|
||||
| 25/03 | Clément Bobin |
|
||||
| 31/03 | Joséphine Vetu |
|
||||
|
||||
---
|
||||
|
||||
@@ -18,12 +19,12 @@
|
||||
|
||||
Avant de lancer l'application, assurez-vous d'avoir installé les outils suivants :
|
||||
|
||||
| Outil | Version minimale | Lien |
|
||||
|-------|-----------------|------|
|
||||
| .NET SDK | 10.0 | https://dotnet.microsoft.com/download |
|
||||
| Node.js (optionnel, pour outils front) | 18+ | https://nodejs.org |
|
||||
| Git | 2.x | https://git-scm.com |
|
||||
| Un IDE | Visual Studio 2022+ ou Rider | — |
|
||||
| Outil | Version minimale | Lien |
|
||||
| -------------------------------------- | ---------------------------- | ------------------------------------- |
|
||||
| .NET SDK | 10.0 | https://dotnet.microsoft.com/download |
|
||||
| Node.js (optionnel, pour outils front) | 18+ | https://nodejs.org |
|
||||
| Git | 2.x | https://git-scm.com |
|
||||
| Un IDE | Visual Studio 2022+ ou Rider | — |
|
||||
|
||||
---
|
||||
|
||||
@@ -65,6 +66,7 @@ dotnet run
|
||||
```
|
||||
|
||||
L'application est accessible par défaut à :
|
||||
|
||||
- **HTTP :** http://localhost:5038
|
||||
- **HTTPS :** https://localhost:7095
|
||||
|
||||
@@ -89,10 +91,10 @@ Le fichier principal de configuration est `Webzine.WebApplication/appsettings.js
|
||||
}
|
||||
```
|
||||
|
||||
| Propriété | Type | Description | Valeur par défaut |
|
||||
|-----------|------|-------------|-------------------|
|
||||
| `NombreDerniereChronique` | int | Nombre de chroniques affichées sur la page d'accueil (section "Derniers titres") | 3 |
|
||||
| `NombreDeTopTitres` | int | Nombre de titres affichés dans le bloc "Titres les plus populaires" | 3 |
|
||||
| Propriété | Type | Description | Valeur par défaut |
|
||||
| ------------------------- | ---- | -------------------------------------------------------------------------------- | ----------------- |
|
||||
| `NombreDerniereChronique` | int | Nombre de chroniques affichées sur la page d'accueil (section "Derniers titres") | 3 |
|
||||
| `NombreDeTopTitres` | int | Nombre de titres affichés dans le bloc "Titres les plus populaires" | 3 |
|
||||
|
||||
Ces valeurs sont injectées dans `AccueilController` via `IConfiguration` et peuvent être modifiées sans recompilation.
|
||||
|
||||
@@ -106,14 +108,15 @@ La configuration du logging se trouve dans `Webzine.WebApplication/nlog.config`.
|
||||
|
||||
Les logs sont écrits dans le dossier `/Logs/` avec deux fichiers :
|
||||
|
||||
| Fichier | Contenu |
|
||||
|---------|---------|
|
||||
| Fichier | Contenu |
|
||||
| --------------------- | ----------------------------------------------------- |
|
||||
| `nlog-all-{date}.log` | Tous les logs (Debug et supérieur pour l'application) |
|
||||
| `nlog-own-{date}.log` | Logs applicatifs avec URL de la requête |
|
||||
| `nlog-own-{date}.log` | Logs applicatifs avec URL de la requête |
|
||||
|
||||
Les logs de la console sont également activés, utiles lors du développement.
|
||||
|
||||
**Niveaux configurés :**
|
||||
|
||||
- `Webzine.WebApplication.*` → Debug et supérieur
|
||||
- `Microsoft.*` → Warning et supérieur (pour réduire le bruit)
|
||||
- `Microsoft.Hosting.Lifetime*` → Info (pour voir le démarrage de l'appli)
|
||||
@@ -143,18 +146,18 @@ Les tests vérifient les contraintes de validation (annotations DataAnnotations)
|
||||
|
||||
## 8. Routes principales
|
||||
|
||||
| URL | Contrôleur | Description |
|
||||
|-----|-----------|-------------|
|
||||
| `/` | `AccueilController.Index` | Page d'accueil |
|
||||
| `/artiste/{nom}` | `ArtisteController.Index` | Page d'un artiste |
|
||||
| `/titre/{id}` | `TitreController.Details` | Détail d'un titre |
|
||||
| `/titre/style/{style}` | `TitreController.Style` | Titres par style |
|
||||
| `/recherche` (POST) | `RechercheController.Index` | Résultats de recherche |
|
||||
| `/Administration/Dashboard` | `DashboardController.Index` | Tableau de bord admin |
|
||||
| `/Administration/Artiste` | `ArtisteController` (admin) | Gestion des artistes |
|
||||
| `/Administration/Titre` | `TitreController` (admin) | Gestion des titres |
|
||||
| `/Administration/Style` | `StyleController` | Gestion des styles |
|
||||
| `/Administration/Commentaire` | `CommentaireController` | Gestion des commentaires |
|
||||
| URL | Contrôleur | Description |
|
||||
| ----------------------------- | --------------------------- | ------------------------ |
|
||||
| `/` | `AccueilController.Index` | Page d'accueil |
|
||||
| `/artiste/{nom}` | `ArtisteController.Index` | Page d'un artiste |
|
||||
| `/titre/{id}` | `TitreController.Details` | Détail d'un titre |
|
||||
| `/titre/style/{style}` | `TitreController.Style` | Titres par style |
|
||||
| `/recherche` (POST) | `RechercheController.Index` | Résultats de recherche |
|
||||
| `/Administration/Dashboard` | `DashboardController.Index` | Tableau de bord admin |
|
||||
| `/Administration/Artiste` | `ArtisteController` (admin) | Gestion des artistes |
|
||||
| `/Administration/Titre` | `TitreController` (admin) | Gestion des titres |
|
||||
| `/Administration/Style` | `StyleController` | Gestion des styles |
|
||||
| `/Administration/Commentaire` | `CommentaireController` | Gestion des commentaires |
|
||||
|
||||
---
|
||||
|
||||
@@ -168,4 +171,14 @@ En production, positionner :
|
||||
export ASPNETCORE_ENVIRONMENT=Production
|
||||
```
|
||||
|
||||
Cela désactive les pages d'erreur détaillées et active les optimisations de performance ASP.NET Core.
|
||||
Cela désactive les pages d'erreur détaillées et active les optimisations de performance ASP.NET Core.
|
||||
|
||||
## Ajout du pre-commit
|
||||
|
||||
Les fichiers présents dans le dossier git_hooks sont à copier dans le dossier caché .git.
|
||||
Le pre-commit reformatte le code à chaque commit.
|
||||
Le commit-msg vérifie si le message du commit respecte bien les conventions du cahier des charges:
|
||||
|
||||
- le message référence un ticket
|
||||
- le message termine par un point
|
||||
- le message doit faire au moins 10 caractères
|
||||
|
||||
@@ -2,14 +2,8 @@
|
||||
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
|
||||
"settings": {
|
||||
"documentationRules": {
|
||||
"documentInterfaces": false,
|
||||
"documentInternalElements": false,
|
||||
"documentExposedElements": false
|
||||
},
|
||||
"maintainabilityRules": {
|
||||
"settings": {
|
||||
"commonWords": [ "Obtient", "définit" ]
|
||||
}
|
||||
"companyName": "Equipe 1 - BOBIN, MASI, NODON, VETU",
|
||||
"documentationCulture": "fr-FR"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
24
Webzine.Documentation/git_hooks/commit-msg
Normal file
24
Webzine.Documentation/git_hooks/commit-msg
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Hook: commit-msg
|
||||
# Validates the commit message format.
|
||||
# Git passes the path to the temp message file as $1.
|
||||
|
||||
COMMIT_MSG=$(cat "$1")
|
||||
|
||||
if [ ${#COMMIT_MSG} -le 10 ]; then
|
||||
echo "❌ Erreur : Le message doit faire plus de 10 caractères."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! echo "$COMMIT_MSG" | grep -q "\.$"; then
|
||||
echo "❌ Erreur : Le commit doit se terminer par un point."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! echo "$COMMIT_MSG" | grep -q "#[0-9]\+"; then
|
||||
echo "❌ Erreur : Vous devez faire référence à un ticket (ex: #123)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
21
Webzine.Documentation/git_hooks/pre-commit
Normal file
21
Webzine.Documentation/git_hooks/pre-commit
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Hook: pre-commit
|
||||
# Runs dotnet format on staged files, then verifies documentation warnings.
|
||||
|
||||
echo "🔧 Running dotnet format..."
|
||||
dotnet format --severity warn
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Erreur : dotnet format a échoué."
|
||||
exit 1
|
||||
fi
|
||||
git add -u
|
||||
|
||||
echo "📄 Vérification de la documentation..."
|
||||
dotnet format style --severity warn --verify-no-changes
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Erreur : Documentation manquante (classes/méthodes non commentées)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
2
Webzine.Entity.Tests/.editorconfig
Normal file
2
Webzine.Entity.Tests/.editorconfig
Normal file
@@ -0,0 +1,2 @@
|
||||
[*.cs]
|
||||
dotnet_diagnostic.SA1600.severity = none
|
||||
@@ -44,5 +44,12 @@ namespace Webzine.Repository.Contracts
|
||||
/// </summary>
|
||||
/// <param name="artiste">L'artiste à mettre à jour.</param>
|
||||
void Update(Artiste artiste);
|
||||
|
||||
/// <summary>
|
||||
/// Récupérer une liste d'artiste à partir d'une recherche.
|
||||
/// </summary>
|
||||
/// <param name="nom">Nom de l'artiste.</param>
|
||||
/// <returns>IEnumarble.<Artiste> qui contient la chaine de caractere.</returns>
|
||||
IEnumerable<Artiste> Search(string nom);
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
namespace Webzine.Repository
|
||||
{
|
||||
using System.Data.Common;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -85,8 +83,8 @@ namespace Webzine.Repository
|
||||
try
|
||||
{
|
||||
Artiste artiste = this.context.Artistes
|
||||
.Include(a => a.Titres)
|
||||
.First(a => a.IdArtiste == id);
|
||||
.Include(a => a.Titres)
|
||||
.FirstOrDefault(a => a.IdArtiste == id);
|
||||
return artiste;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -120,7 +118,7 @@ namespace Webzine.Repository
|
||||
try
|
||||
{
|
||||
// .AsNoTracking() rend la requête beaucoup plus rapide pour de la lecture
|
||||
var artistes = this.context.Artistes.AsNoTracking().ToList();
|
||||
var artistes = this.context.Artistes.AsNoTracking().Include(t => t.Titres).ToList();
|
||||
this.logger.LogDebug("{Count} artistes récupérés de la base.", artistes.Count);
|
||||
return artistes;
|
||||
}
|
||||
@@ -156,5 +154,27 @@ namespace Webzine.Repository
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<Artiste> Search(string mot)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Récupération des artistes et des titres
|
||||
// qui leurs sont associés.
|
||||
// ajout de 'ToLower' pour ne pas être sensible à la casse.
|
||||
// NoTracking car action de lecture seulement.
|
||||
var artiste = this.context.Artistes
|
||||
.Where(a => a.Nom.ToLower().Contains(mot.ToLower()))
|
||||
.Include(t => t.Titres)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
return artiste;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("Erreur lors de la recherche d'artiste {error}", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
namespace Webzine.Repository;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
using Webzine.EntitiesContext;
|
||||
using Webzine.Entity;
|
||||
using Webzine.Repository.Contracts;
|
||||
|
||||
namespace Webzine.Repository;
|
||||
|
||||
/// <summary>
|
||||
/// Classe qui implémente le repository pour les styles en utilisant une base de données.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
namespace Webzine.Repository;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
using Webzine.EntitiesContext;
|
||||
using Webzine.Entity;
|
||||
using Webzine.Repository.Contracts;
|
||||
|
||||
namespace Webzine.Repository;
|
||||
|
||||
/// <summary>
|
||||
/// Classe qui implémente le repository pour les titres en utilisant une base de données.
|
||||
/// </summary>
|
||||
@@ -242,6 +243,7 @@ public class DbTitreRepository : ITitreRepository
|
||||
.Include(t => t.Styles)
|
||||
.Where(t => t.Libelle.ToLower().Contains(mot.ToLower()))
|
||||
.OrderBy(t => t.Libelle)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
|
||||
this.logger.LogDebug("{Count} titres trouvés correspondant à '{Mot}'", titres.Count, mot);
|
||||
@@ -260,15 +262,13 @@ public class DbTitreRepository : ITitreRepository
|
||||
try
|
||||
{
|
||||
this.logger.LogDebug("Recherche du titre avec l'ID: {IdTitre}", idTitre);
|
||||
this.logger.LogDebug("Préparation de la requête avec les inclusions Artiste, Styles et Commentaires");
|
||||
|
||||
var titre = this.context.Titres
|
||||
.Include(t => t.Artiste)
|
||||
.Include(t => t.Styles)
|
||||
.Include(t => t.Commentaires)
|
||||
.First(t => t.IdTitre == idTitre);
|
||||
.FirstOrDefault(t => t.IdTitre == idTitre);
|
||||
|
||||
this.logger.LogDebug("Titre trouvé: {Libelle}", titre.Libelle);
|
||||
return titre;
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
|
||||
@@ -85,5 +85,13 @@ namespace Webzine.Repository
|
||||
{
|
||||
throw new NotSupportedException("Mode Local");
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<Artiste> Search(string mot)
|
||||
{
|
||||
return this.dataStore.Artistes
|
||||
.Where(a => a.Nom.ToLower().Contains(mot.ToLower()))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
namespace Webzine.Repository;
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
using Webzine.Entity;
|
||||
using Webzine.Repository.Contracts;
|
||||
|
||||
namespace Webzine.Repository;
|
||||
|
||||
/// <summary>
|
||||
/// Classe qui implémente le repository pour les styles en utilisant une liste locale comme source de données.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
namespace Webzine.Repository;
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
using Webzine.Entity;
|
||||
using Webzine.Repository.Contracts;
|
||||
|
||||
namespace Webzine.Repository;
|
||||
|
||||
/// <summary>
|
||||
/// Classe qui implémente le repository pour les titres en utilisant une liste locale comme source de données.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
namespace Webzine.WebApplication.Areas.Administration.Controllers;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
using Webzine.Entity;
|
||||
using Webzine.Repository.Contracts;
|
||||
using Webzine.WebApplication.Areas.Administration.ViewModels.Artiste;
|
||||
|
||||
namespace Webzine.WebApplication.Areas.Administration.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// Contrôleur pour la gestion des artistes dans l'administration du webzine.
|
||||
/// </summary>
|
||||
@@ -49,14 +50,37 @@ public class ArtisteController : Controller
|
||||
/// <returns>Redirection.</returns>
|
||||
public IActionResult Create()
|
||||
{
|
||||
var model = new AdminArtisteForm
|
||||
return this.View();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Formulaire de création d'un artiste.
|
||||
/// </summary>
|
||||
/// <param name="model">Paramètre nécessaire pour la création d'un artiste.</param>
|
||||
/// <returns>Redirection sur la page Index.</returns>
|
||||
[HttpPost]
|
||||
public IActionResult Create(ArtisteCreateViewModel model)
|
||||
{
|
||||
// vérifier si les données sont corrects.
|
||||
if (!this.ModelState.IsValid)
|
||||
{
|
||||
Id = 0,
|
||||
Nom = string.Empty,
|
||||
Biographie = string.Empty,
|
||||
// Passer model en paramètre afin que
|
||||
// l'utilisateur conserve sa saissie.
|
||||
return this.View(model);
|
||||
}
|
||||
|
||||
// Créer un objet Artiste avecc les paramètres.
|
||||
var artiste = new Artiste
|
||||
{
|
||||
Nom = model.Nom,
|
||||
Biographie = model.Biographie,
|
||||
};
|
||||
|
||||
return this.View(model);
|
||||
// Persister les données.
|
||||
this.artisteRepository.Add(artiste);
|
||||
|
||||
// Renvoyer sur la page Index.
|
||||
return this.RedirectToAction("Index");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -68,14 +92,37 @@ public class ArtisteController : Controller
|
||||
{
|
||||
var artiste = this.artisteRepository.Find(id);
|
||||
|
||||
var model = new AdminArtisteForm
|
||||
if (artiste == null)
|
||||
{
|
||||
Id = artiste.IdArtiste,
|
||||
Nom = artiste.Nom,
|
||||
Biographie = artiste.Biographie,
|
||||
return this.RedirectToAction("Index");
|
||||
}
|
||||
|
||||
return this.View(artiste);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Traitement du formulaire de modification d'un artiste.
|
||||
/// </summary>
|
||||
/// <param name="model">Paramètre d'un artiste.</param>
|
||||
/// <returns>Redirection sur Index.</returns>
|
||||
[HttpPost]
|
||||
public IActionResult Edit(ArtisteEditViewModel model)
|
||||
{
|
||||
var artiste = new Artiste
|
||||
{
|
||||
IdArtiste = model.Id,
|
||||
Nom = model.Nom,
|
||||
Biographie = model.Biographie,
|
||||
};
|
||||
|
||||
return this.View(model);
|
||||
if (!this.ModelState.IsValid)
|
||||
{
|
||||
return this.View(artiste);
|
||||
}
|
||||
|
||||
this.artisteRepository.Update(artiste);
|
||||
|
||||
return this.RedirectToAction("Index");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -86,6 +133,12 @@ public class ArtisteController : Controller
|
||||
public IActionResult Delete(int id)
|
||||
{
|
||||
var artiste = this.artisteRepository.Find(id);
|
||||
|
||||
if (artiste == null)
|
||||
{
|
||||
return this.RedirectToAction("Index");
|
||||
}
|
||||
|
||||
var model = new AdminArtisteForm
|
||||
{
|
||||
Id = id,
|
||||
|
||||
@@ -53,6 +53,11 @@ namespace Webzine.WebApplication.Areas.Administration.Controllers
|
||||
{
|
||||
var commentaire = this.commentaireRepository.Find(id);
|
||||
|
||||
if (commentaire == null)
|
||||
{
|
||||
return this.RedirectToAction("Index");
|
||||
}
|
||||
|
||||
var model = new CommentaireDeleteViewModel
|
||||
{
|
||||
IdCommentaire = commentaire.IdCommentaire,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Diagnostics;
|
||||
namespace Webzine.WebApplication.Areas.Administration.Controllers;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
using Webzine.Repository.Contracts;
|
||||
using Webzine.WebApplication.Areas.Administration.ViewModels;
|
||||
|
||||
namespace Webzine.WebApplication.Areas.Administration.Controllers;
|
||||
|
||||
[Area("Administration")]
|
||||
public class DashboardController : Controller
|
||||
{
|
||||
|
||||
@@ -1,109 +1,170 @@
|
||||
namespace Webzine.WebApplication.Areas.Administration.Controllers
|
||||
{
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
namespace Webzine.WebApplication.Areas.Administration.Controllers;
|
||||
|
||||
using Webzine.Repository.Contracts;
|
||||
using Webzine.WebApplication.Areas.Administration.ViewModels.Style;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
using Webzine.Entity;
|
||||
using Webzine.Repository.Contracts;
|
||||
using Webzine.WebApplication.Areas.Administration.ViewModels.Style;
|
||||
|
||||
/// <summary>
|
||||
/// Controleur pour la gestion des styles dans l'administration du webzine.
|
||||
/// </summary>
|
||||
[Area("Administration")]
|
||||
public class StyleController : Controller
|
||||
{
|
||||
private readonly ILogger<StyleController> logger;
|
||||
private readonly IStyleRepository styleRepository;
|
||||
|
||||
/// <summary>
|
||||
/// Contrôleur pour la gestion des styles dans l'administration du webzine.
|
||||
/// Initializes a new instance of the <see cref="StyleController"/> class.
|
||||
/// </summary>
|
||||
[Area("Administration")]
|
||||
public class StyleController : Controller
|
||||
/// <param name="logger">Service de journalisation injecte.</param>
|
||||
/// <param name="styleRepository">Repository des styles injecte.</param>
|
||||
public StyleController(
|
||||
ILogger<StyleController> logger,
|
||||
IStyleRepository styleRepository)
|
||||
{
|
||||
private readonly ILogger<StyleController> logger;
|
||||
private readonly IStyleRepository styleRepository;
|
||||
this.logger = logger;
|
||||
this.styleRepository = styleRepository;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StyleController"/> class.
|
||||
/// Initialise une nouvelle instance de la classe <see cref="StyleController"/>.
|
||||
/// </summary>
|
||||
/// <param name="logger">Service de journalisation injecté.</param>
|
||||
/// <param name="styles">Repository des styles injecté.</param>
|
||||
public StyleController(
|
||||
ILogger<StyleController> logger,
|
||||
IStyleRepository styleRepository)
|
||||
this.logger.LogInformation("Initialisation du controleur StyleController.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Affiche la liste des styles dans la vue Index.
|
||||
/// </summary>
|
||||
/// <returns>La vue Index avec la liste des styles.</returns>
|
||||
public IActionResult Index()
|
||||
{
|
||||
IEnumerable<Style> listeStyles = this.styleRepository.FindAll().Take(10);
|
||||
|
||||
return this.View(listeStyles);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Affiche la vue de creation d'un nouveau style.
|
||||
/// </summary>
|
||||
/// <returns>La vue Create pour ajouter un nouveau style.</returns>
|
||||
public IActionResult Create()
|
||||
{
|
||||
var model = new StyleCreateViewModel
|
||||
{
|
||||
this.logger = logger;
|
||||
Libelle = string.Empty,
|
||||
};
|
||||
|
||||
this.logger.LogInformation("Initialisation du contrôleur StyleController.");
|
||||
return this.View(model);
|
||||
}
|
||||
|
||||
this.styleRepository = styleRepository;
|
||||
/// <summary>
|
||||
/// Cree un nouveau style.
|
||||
/// </summary>
|
||||
/// <param name="model">Nouveau style.</param>
|
||||
/// <returns>IActionResult.</returns>
|
||||
[HttpPost]
|
||||
public IActionResult Create(StyleCreateViewModel model)
|
||||
{
|
||||
if (!this.ModelState.IsValid)
|
||||
{
|
||||
return this.View(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Affiche la liste des styles dans la vue Index.
|
||||
/// </summary>
|
||||
/// <returns>La vue Index avec le ViewModel contenant la liste des styles.</returns>
|
||||
public IActionResult Index()
|
||||
var style = new Style
|
||||
{
|
||||
var listeStyles = this.styleRepository.FindAll().Take(10);
|
||||
Libelle = model.Libelle,
|
||||
};
|
||||
|
||||
return this.View(listeStyles);
|
||||
}
|
||||
this.styleRepository.Add(style);
|
||||
|
||||
/// <summary>
|
||||
/// Affiche la vue de création d'un nouveau style.
|
||||
/// </summary>
|
||||
/// <returns>La vue Create pour ajouter un nouveau style.</returns>
|
||||
public IActionResult Create()
|
||||
return this.RedirectToAction("Index");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Affiche la vue de confirmation de suppression d'un style.
|
||||
/// </summary>
|
||||
/// <param name="id">L'identifiant du style a supprimer.</param>
|
||||
/// <returns>La vue de confirmation ou une redirection vers l'index si le style n'existe pas.</returns>
|
||||
public IActionResult Delete(int id)
|
||||
{
|
||||
var style = this.styleRepository.Find(id);
|
||||
|
||||
if (style == null || style.IdStyle == 0)
|
||||
{
|
||||
return this.View();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Affiche la vue de confirmation de suppression d'un style, en récupérant les détails du style à supprimer à partir de l'identifiant fourni.
|
||||
/// </summary>
|
||||
/// <param name="id">L'identifiant du style à supprimer.</param>
|
||||
/// <returns>La vue de confirmation de suppression avec le ViewModel contenant les détails du style à supprimer, ou une redirection vers l'index si le style n'existe pas.</returns>
|
||||
public IActionResult Delete(int id)
|
||||
{
|
||||
var style = this.styleRepository.Find(id);
|
||||
|
||||
var vm = new StyleDeleteViewModel
|
||||
{
|
||||
IdStyle = style.IdStyle,
|
||||
Libelle = style.Libelle,
|
||||
};
|
||||
|
||||
return this.View(vm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Méthode POST pour supprimer un style.
|
||||
/// </summary>
|
||||
/// <param name="model">Le style à supprimer.</param>
|
||||
/// <returns>Redirige vers la page d'index d'admin style.</returns>
|
||||
[HttpPost]
|
||||
public IActionResult Delete(StyleEditViewModel model)
|
||||
{
|
||||
var style = this.styleRepository.Find(model.IdStyle);
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
this.styleRepository.Delete(style);
|
||||
}
|
||||
|
||||
return this.RedirectToAction("Index");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Affiche la vue d'édition d'un style existant, en récupérant les détails du style à éditer à partir de l'identifiant fourni.
|
||||
/// </summary>
|
||||
/// <param name="id">L'identifiant du style à éditer.</param>
|
||||
/// <returns>La vue d'édition avec le ViewModel contenant les détails du style à éditer, ou une redirection vers l'index si le style n'existe pas.</returns>
|
||||
[HttpGet]
|
||||
public IActionResult Edit(int id)
|
||||
var model = new StyleDeleteViewModel
|
||||
{
|
||||
var style = this.styleRepository.Find(id);
|
||||
IdStyle = style.IdStyle,
|
||||
Libelle = style.Libelle,
|
||||
};
|
||||
|
||||
var model = new StyleEditViewModel
|
||||
{
|
||||
IdStyle = style.IdStyle,
|
||||
Libelle = style.Libelle,
|
||||
};
|
||||
return this.View(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Methode POST pour supprimer un style.
|
||||
/// </summary>
|
||||
/// <param name="model">Le style a supprimer.</param>
|
||||
/// <returns>Redirige vers la page d'index d'admin style.</returns>
|
||||
[HttpPost]
|
||||
public IActionResult Delete(StyleDeleteViewModel model)
|
||||
{
|
||||
var style = this.styleRepository.Find(model.IdStyle);
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
this.styleRepository.Delete(style);
|
||||
}
|
||||
|
||||
return this.RedirectToAction("Index");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Affiche la vue d'edition d'un style existant.
|
||||
/// </summary>
|
||||
/// <param name="id">L'identifiant du style a editer.</param>
|
||||
/// <returns>La vue d'edition ou une redirection vers l'index si le style n'existe pas.</returns>
|
||||
[HttpGet]
|
||||
public IActionResult Edit(int id)
|
||||
{
|
||||
var style = this.styleRepository.Find(id);
|
||||
|
||||
if (style == null || style.IdStyle == 0)
|
||||
{
|
||||
return this.RedirectToAction("Index");
|
||||
}
|
||||
|
||||
var model = new StyleEditViewModel
|
||||
{
|
||||
IdStyle = style.IdStyle,
|
||||
Libelle = style.Libelle,
|
||||
};
|
||||
|
||||
return this.View(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Met a jour un style existant.
|
||||
/// </summary>
|
||||
/// <param name="model">Donnees du style a modifier.</param>
|
||||
/// <returns>Redirige vers la page d'index d'admin style.</returns>
|
||||
[HttpPost]
|
||||
public IActionResult Edit(StyleEditViewModel model)
|
||||
{
|
||||
if (!this.ModelState.IsValid)
|
||||
{
|
||||
return this.View(model);
|
||||
}
|
||||
|
||||
var style = this.styleRepository.Find(model.IdStyle);
|
||||
if (style == null)
|
||||
{
|
||||
return this.RedirectToAction("Index");
|
||||
}
|
||||
|
||||
style.Libelle = model.Libelle;
|
||||
this.styleRepository.Update(style);
|
||||
|
||||
return this.RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
namespace Webzine.WebApplication.Areas.Administration.Controllers;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
using Webzine.Entity;
|
||||
using Webzine.Repository.Contracts;
|
||||
using Webzine.WebApplication.Areas.Administration.ViewModels.Titre;
|
||||
|
||||
namespace Webzine.WebApplication.Areas.Administration.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// Contrôleur pour la gestion des titres en administration. Ce contrôleur gère les opérations de création, modification, suppression et affichage des titres dans l'interface d'administration du webzine. Chaque action du contrôleur prépare un ViewModel spécifique pour la vue correspondante, permettant ainsi une séparation claire entre la logique métier et la présentation des données.
|
||||
/// </summary>
|
||||
@@ -129,6 +130,11 @@ public class TitreController : Controller
|
||||
{
|
||||
var titre = this.titreRepository.Find(id);
|
||||
|
||||
if (titre == null)
|
||||
{
|
||||
return this.RedirectToAction("Index");
|
||||
}
|
||||
|
||||
var model = new AdminTitreDelete
|
||||
{
|
||||
Id = titre.IdTitre,
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace Webzine.WebApplication.Areas.Administration.ViewModels.Artiste
|
||||
{
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
/// <summary>
|
||||
/// ViewModel qui sert à la création d'un artiste.
|
||||
/// </summary>
|
||||
public class ArtisteCreateViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Nom de l'artiste.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Nom { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Biographie de l'artiste.
|
||||
/// </summary>
|
||||
public string Biographie { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace Webzine.WebApplication.Areas.Administration.ViewModels.Artiste
|
||||
{
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
/// <summary>
|
||||
/// Permet d'éditer un Artiste.
|
||||
/// </summary>
|
||||
public class ArtisteEditViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Id de l'artiste.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Nom de l'artiste.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Nom { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Biographie de l'artiste.
|
||||
/// </summary>
|
||||
public string Biographie { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// <copyright file="CommentaireViewModel.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// <copyright file="CommentaireViewModel.cs" company="Equipe 1 - BOBIN, MASI, NODON, VETU">
|
||||
// Copyright (c) Equipe 1 - BOBIN, MASI, NODON, VETU. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace Webzine.WebApplication.Areas.Administration.ViewModels.Commentaire
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
// <copyright file="StyleCreateViewModel.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// <copyright file="StyleCreateViewModel.cs" company="Equipe 1 - BOBIN, MASI, NODON, VETU">
|
||||
// Copyright (c) Equipe 1 - BOBIN, MASI, NODON, VETU. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace Webzine.WebApplication.Areas.Administration.ViewModels.Style
|
||||
{
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
/// <summary>
|
||||
/// ViewModel pour la création d'un style en administration.
|
||||
/// </summary>
|
||||
@@ -12,6 +14,7 @@ namespace Webzine.WebApplication.Areas.Administration.ViewModels.Style
|
||||
/// <summary>
|
||||
/// Obtient ou définit le libellé du style.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Libelle { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// <copyright file="StyleDeleteViewModel.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// <copyright file="StyleDeleteViewModel.cs" company="Equipe 1 - BOBIN, MASI, NODON, VETU">
|
||||
// Copyright (c) Equipe 1 - BOBIN, MASI, NODON, VETU. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace Webzine.WebApplication.Areas.Administration.ViewModels.Style
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
// <copyright file="StyleEditViewModel.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// <copyright file="StyleEditViewModel.cs" company="Equipe 1 - BOBIN, MASI, NODON, VETU">
|
||||
// Copyright (c) Equipe 1 - BOBIN, MASI, NODON, VETU. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace Webzine.WebApplication.Areas.Administration.ViewModels.Style
|
||||
{
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
/// <summary>
|
||||
/// ViewModel pour la modification d'un style en administration.
|
||||
/// </summary>
|
||||
public class StyleEditViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Obtient ou définit le libellé du style.
|
||||
/// Obtient ou definit l'identifiant du style.
|
||||
/// </summary>
|
||||
public int IdStyle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Obtient ou définit le libellé du style.
|
||||
/// Obtient ou definit le libelle du style.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Libelle { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
namespace Webzine.WebApplication.Areas.Administration.ViewModels.Titre;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
/// <summary>
|
||||
/// ViewModel pour la création et la modification d'un titre dans l'administration.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,11 +1,41 @@
|
||||
@model Webzine.WebApplication.Areas.Administration.ViewModels.Artiste.AdminArtisteForm
|
||||
@model Webzine.WebApplication.Areas.Administration.ViewModels.Artiste.ArtisteCreateViewModel
|
||||
|
||||
<h1>Créer un artiste</h1>
|
||||
|
||||
<hr />
|
||||
|
||||
<form asp-action="Create" method="post">
|
||||
<div class="container">
|
||||
<!-- ARTISTE -->
|
||||
<div class="row mb-3">
|
||||
<label class="col-md-3 col-form-label">Nom de l'artiste<span class="text-danger">*</span></label>
|
||||
<div class="col-md-9">
|
||||
<input asp-for="Nom" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<partial name="_Form" />
|
||||
<!-- BIOGRAPHIE -->
|
||||
<div class="row mb-3">
|
||||
<label class="col-md-3 col-form-label">Biographie</label>
|
||||
<div class="col-md-9">
|
||||
<textarea asp-for="Biographie" class="form-control" rows="5"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- BOUTONS -->
|
||||
<div class="row mt-4">
|
||||
<div class="col-md-9 offset-md-3">
|
||||
<button type="submit" class="btn btn-primary me-2">
|
||||
Sauvegarder
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<a asp-action="Index"
|
||||
class="btn text-primary">
|
||||
Retour à l'administration des artistes
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
@@ -1,4 +1,4 @@
|
||||
@model Webzine.WebApplication.Areas.Administration.ViewModels.Artiste.AdminArtisteForm
|
||||
@model Webzine.Entity.Artiste
|
||||
|
||||
<h1>Editer un artiste</h1>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<form asp-action="Edit" method="post">
|
||||
|
||||
<input type="hidden" asp-for="Id"/>
|
||||
<input type="hidden" asp-for="IdArtiste"/>
|
||||
|
||||
<partial name="_Form" />
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@model Webzine.WebApplication.Areas.Administration.ViewModels.Artiste.AdminArtisteForm
|
||||
@model Webzine.Entity.Artiste
|
||||
|
||||
<div class="container">
|
||||
<!-- ARTISTE -->
|
||||
@@ -17,8 +17,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- BOUTONS -->
|
||||
<div class="row mt-4">
|
||||
<div class="col-md-9 offset-md-3">
|
||||
|
||||
13
Webzine.WebApplication/Configuration/AppEnums.cs
Normal file
13
Webzine.WebApplication/Configuration/AppEnums.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace Webzine.WebApplication.Configuration;
|
||||
|
||||
public enum SeederType
|
||||
{
|
||||
Local,
|
||||
Spotify,
|
||||
}
|
||||
|
||||
public enum RepositoryType
|
||||
{
|
||||
Local,
|
||||
Db,
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Webzine.WebApplication.Controllers;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
public class ApiController : ControllerBase
|
||||
{
|
||||
private readonly ILogger<ApiController> logger;
|
||||
@@ -29,7 +29,7 @@ public class ApiController : ControllerBase
|
||||
return this.Ok(new
|
||||
{
|
||||
nom = "webzine",
|
||||
version = "2.0",
|
||||
version = "3.0",
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// <copyright file="RechercheController.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// <copyright file="RechercheController.cs" company="Equipe 1 - BOBIN, MASI, NODON, VETU">
|
||||
// Copyright (c) Equipe 1 - BOBIN, MASI, NODON, VETU. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace Webzine.WebApplication.Controllers
|
||||
@@ -8,53 +8,40 @@ namespace Webzine.WebApplication.Controllers
|
||||
|
||||
using Webzine.Repository.Contracts;
|
||||
using Webzine.WebApplication.ViewModels.Recherche;
|
||||
using Webzine.WebApplication.ViewModels.Titre;
|
||||
|
||||
public class RechercheController : Controller
|
||||
{
|
||||
private readonly ILogger<RechercheController> logger;
|
||||
private readonly ITitreRepository titreRepository;
|
||||
private readonly IArtisteRepository artisteRepository;
|
||||
|
||||
public RechercheController(ILogger<RechercheController> logger, ITitreRepository titreRepository)
|
||||
public RechercheController(
|
||||
ILogger<RechercheController> logger,
|
||||
ITitreRepository titreRepository,
|
||||
IArtisteRepository artisteRepository)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.titreRepository = titreRepository;
|
||||
this.artisteRepository = artisteRepository;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
/// <summary>
|
||||
/// Affichage de la page Recherche depuis le header de l'app.
|
||||
/// </summary>
|
||||
/// <param name="mot">Nom d'artiste ou de titre.</param>
|
||||
/// <returns>Page de recherche avec les r<>sultats.</returns>
|
||||
public IActionResult Index(string mot)
|
||||
{
|
||||
// Logger la recherche.
|
||||
this.logger.LogInformation("Recherche artistes/titres pour le mot : {Mot}.", mot);
|
||||
|
||||
var titres = this.titreRepository.Search(mot)
|
||||
.Concat(this.titreRepository.SearchByStyle(mot))
|
||||
.DistinctBy(t => t.IdTitre)
|
||||
.OrderBy(t => t.Libelle)
|
||||
.Select(t => new TitreStyleItem
|
||||
{
|
||||
IdTitre = t.IdTitre,
|
||||
Libelle = t.Libelle,
|
||||
ArtisteNom = t.Artiste?.Nom,
|
||||
UrlJaquette = t.UrlJaquette,
|
||||
Duree = t.Duree,
|
||||
})
|
||||
.ToList();
|
||||
// Recherche des titres.
|
||||
var titres = this.titreRepository.Search(mot);
|
||||
|
||||
var artistes = this.titreRepository.FindAll()
|
||||
.Select(t => t.Artiste)
|
||||
.Where(a => a != null
|
||||
&& !string.IsNullOrWhiteSpace(a.Nom)
|
||||
&& !string.IsNullOrWhiteSpace(mot)
|
||||
&& a.Nom.Contains(mot, StringComparison.OrdinalIgnoreCase))
|
||||
.DistinctBy(a => a!.IdArtiste)
|
||||
.OrderBy(a => a!.Nom)
|
||||
.Select(a => new RechercheArtisteItem
|
||||
{
|
||||
Nom = a!.Nom,
|
||||
NombreDeTitres = a.Titres?.Count ?? 0,
|
||||
})
|
||||
.ToList();
|
||||
// Recherche des artistes.
|
||||
var artistes = this.artisteRepository.Search(mot);
|
||||
|
||||
// Param<61>tres a retourner <20> la vue.
|
||||
var vm = new RechercheIndexViewModel
|
||||
{
|
||||
Mot = mot,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// <copyright file="TitreController.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// <copyright file="TitreController.cs" company="Equipe 1 - BOBIN, MASI, NODON, VETU">
|
||||
// Copyright (c) Equipe 1 - BOBIN, MASI, NODON, VETU. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace Webzine.WebApplication.Controllers
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// L'erreur SA1200 (ordre des using directives) est desactivée pour Program.cs
|
||||
#pragma warning disable SA1200
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using NLog;
|
||||
@@ -8,6 +11,7 @@ using Webzine.Entity;
|
||||
using Webzine.Entity.Fixtures;
|
||||
using Webzine.Repository;
|
||||
using Webzine.Repository.Contracts;
|
||||
using Webzine.WebApplication.Configuration;
|
||||
using Webzine.WebApplication.Extensions;
|
||||
|
||||
// Initiation du logger NLog pour la classe courante afin de pouvoir l'utiliser pour logger des messages d'information, d'erreur, etc avant la construction de l'application.
|
||||
@@ -32,19 +36,20 @@ try
|
||||
builder.Host.UseNLog();
|
||||
|
||||
// En fonction de la configuration, utilise soit les repositories basés sur une base de données, soit les repositories basés sur des listes locales.
|
||||
bool useDatabase = builder.Configuration.GetValue<bool>("UseDatabase");
|
||||
bool isSQLite = builder.Configuration.GetValue<bool>("IsSQLite");
|
||||
if (useDatabase)
|
||||
var repositoryType = builder.Configuration.GetValue<RepositoryType>("Repository");
|
||||
var seederType = builder.Configuration.GetValue<SeederType>("Seeder");
|
||||
var shouldSeed = args.Contains("--seed");
|
||||
if (repositoryType == RepositoryType.Db)
|
||||
{
|
||||
if (isSQLite)
|
||||
if (builder.Environment.IsProduction())
|
||||
{
|
||||
builder.Services.AddDbContext<WebzineDbContext>(options =>
|
||||
options.UseSqlite(builder.Configuration.GetConnectionString("SqliteConnection")));
|
||||
options.UseNpgsql(builder.Configuration.GetConnectionString("PostGreSQLConnection")));
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.Services.AddDbContext<WebzineDbContext>(options =>
|
||||
options.UseNpgsql(builder.Configuration.GetConnectionString("PostGreSQLConnection")));
|
||||
options.UseSqlite(builder.Configuration.GetConnectionString("SqliteConnection")));
|
||||
}
|
||||
|
||||
builder.Services.AddScoped<DbEntityRepository>();
|
||||
@@ -68,29 +73,25 @@ try
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
if (useDatabase)
|
||||
if (repositoryType == RepositoryType.Db)
|
||||
{
|
||||
if (isSQLite)
|
||||
using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
using (var scope = app.Services.CreateScope())
|
||||
var db = scope.ServiceProvider.GetRequiredService<WebzineDbContext>();
|
||||
if (shouldSeed)
|
||||
{
|
||||
var db = scope.ServiceProvider.GetRequiredService<WebzineDbContext>();
|
||||
db.Database.EnsureDeleted();
|
||||
db.Database.EnsureCreated();
|
||||
var repo = scope.ServiceProvider.GetRequiredService<DbEntityRepository>();
|
||||
repo.SeedBaseDeDonnees();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
// TODO : A modifier pour ne pas supprimer la base de donnée en prod
|
||||
var db = scope.ServiceProvider.GetRequiredService<WebzineDbContext>();
|
||||
db.Database.EnsureDeleted();
|
||||
db.Database.EnsureCreated();
|
||||
var repo = scope.ServiceProvider.GetRequiredService<DbEntityRepository>();
|
||||
repo.SeedBaseDeDonnees();
|
||||
|
||||
if (seederType == SeederType.Local)
|
||||
{
|
||||
repo.SeedBaseDeDonnees();
|
||||
}
|
||||
else if (seederType == SeederType.Spotify)
|
||||
{
|
||||
// Seed à l'aide de l'API Spotify.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,26 @@
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"http-seed": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "http://localhost:5038",
|
||||
"commandLineArgs": "--seed",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https-seed": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7095;http://localhost:5038",
|
||||
"commandLineArgs": "--seed",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
namespace Webzine.WebApplication.ViewModels.Recherche;
|
||||
|
||||
/// <summary>
|
||||
/// ViewModel pour afficher un artiste dans les resultats de recherche.
|
||||
/// </summary>
|
||||
public class RechercheArtisteItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Nom de l'artiste.
|
||||
/// </summary>
|
||||
public string? Nom { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Nombre de titres associes a l'artiste.
|
||||
/// </summary>
|
||||
public int NombreDeTitres { get; set; }
|
||||
}
|
||||
@@ -1,24 +1,25 @@
|
||||
using Webzine.WebApplication.ViewModels.Titre;
|
||||
|
||||
namespace Webzine.WebApplication.ViewModels.Recherche;
|
||||
|
||||
/// <summary>
|
||||
/// ViewModel pour afficher les resultats de recherche d'artistes et de titres.
|
||||
/// </summary>
|
||||
public class RechercheIndexViewModel
|
||||
namespace Webzine.WebApplication.ViewModels.Recherche
|
||||
{
|
||||
/// <summary>
|
||||
/// Mot saisi dans le formulaire.
|
||||
/// </summary>
|
||||
public string? Mot { get; set; }
|
||||
using Webzine.Entity;
|
||||
|
||||
/// <summary>
|
||||
/// Artistes trouves.
|
||||
/// ViewModel pour afficher les resultats de recherche d'artistes et de titres.
|
||||
/// </summary>
|
||||
public List<RechercheArtisteItem> Artistes { get; set; } = new ();
|
||||
public class RechercheIndexViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Mot saisi dans le formulaire.
|
||||
/// </summary>
|
||||
public string? Mot { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Titres trouves.
|
||||
/// </summary>
|
||||
public List<TitreStyleItem> Titres { get; set; } = new ();
|
||||
/// <summary>
|
||||
/// Artistes trouves.
|
||||
/// </summary>
|
||||
public IEnumerable<Artiste> Artistes { get; set; } = new List<Artiste>();
|
||||
|
||||
/// <summary>
|
||||
/// Titres trouves.
|
||||
/// </summary>
|
||||
public IEnumerable<Titre> Titres { get; set; } = new List<Titre>();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Webzine.WebApplication.ViewModels.Titre;
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
/// <summary>
|
||||
/// Classe représentant un commentaire sur un titre, utilisée pour la validation des données lors de la soumission d'un commentaire.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Webzine.Entity;
|
||||
|
||||
namespace Webzine.WebApplication.ViewModels.Titre;
|
||||
|
||||
using Webzine.Entity;
|
||||
|
||||
/// <summary>
|
||||
/// Contient les détails d'un titre, ainsi que les commentaires associés.
|
||||
/// </summary>
|
||||
|
||||
@@ -10,74 +10,65 @@
|
||||
<h1 class="mb-4">Resultats pour "@Model.Mot"</h1>
|
||||
|
||||
<hr />
|
||||
<h2 class="h4 mt-4">Artistes</h2>
|
||||
|
||||
@if (string.IsNullOrWhiteSpace(Model.Mot))
|
||||
@if (!Model.Artistes.Any())
|
||||
{
|
||||
<div class="alert alert-info">
|
||||
Saisissez un mot-cle pour lancer une recherche.
|
||||
<p>Aucun artiste n'a été trouvé.</p>
|
||||
</div>
|
||||
}
|
||||
else if (!Model.Artistes.Any() && !Model.Titres.Any())
|
||||
|
||||
@foreach (var artiste in Model.Artistes)
|
||||
{
|
||||
<div class="my-3">
|
||||
<a asp-controller="Artiste"
|
||||
asp-action="Index"
|
||||
asp-route-nom="@artiste.Nom">
|
||||
@artiste.Nom
|
||||
</a>
|
||||
<span class="text-muted">(@artiste.Titres.Count titre(s))</span>
|
||||
</div>
|
||||
}
|
||||
<h2 class="h4 mt-4">Titres</h2>
|
||||
|
||||
@if (!Model.Titres.Any())
|
||||
{
|
||||
<div class="alert alert-info">
|
||||
Aucun artiste ni titre ne correspond a votre recherche.
|
||||
<p>Aucun titre n'a été trouvé.</p>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (Model.Artistes.Any())
|
||||
{
|
||||
<h2 class="h4 mt-4">Artistes</h2>
|
||||
|
||||
@foreach (var artiste in Model.Artistes)
|
||||
{
|
||||
<div class="my-3">
|
||||
@foreach (var titre in Model.Titres)
|
||||
{
|
||||
<div class="d-flex align-items-start my-3">
|
||||
<a asp-controller="Titre"
|
||||
asp-action="Index"
|
||||
asp-route-id="@titre.IdTitre"
|
||||
class="me-3 text-black">
|
||||
<img src="@titre.UrlJaquette" alt="@titre.Libelle" width="70" height="70" class="object-fit-cover" loading="lazy" />
|
||||
</a>
|
||||
|
||||
<div class="justify-content-center d-flex flex-column">
|
||||
<div>
|
||||
<a asp-controller="Artiste"
|
||||
asp-action="Index"
|
||||
asp-route-nom="@artiste.Nom">
|
||||
@artiste.Nom
|
||||
asp-route-nom="@titre.Artiste.Nom">
|
||||
@titre.Artiste.Nom
|
||||
</a>
|
||||
<span class="text-muted">(@artiste.NombreDeTitres titre(s))</span>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
@if (Model.Titres.Any())
|
||||
{
|
||||
<h2 class="h4 mt-4">Titres</h2>
|
||||
|
||||
@foreach (var titre in Model.Titres)
|
||||
{
|
||||
<div class="d-flex align-items-start my-3">
|
||||
-
|
||||
<a asp-controller="Titre"
|
||||
asp-action="Index"
|
||||
asp-route-id="@titre.IdTitre"
|
||||
class="me-3 text-black">
|
||||
<img src="@titre.UrlJaquette" alt="@titre.Libelle" width="70" height="70" class="object-fit-cover" loading="lazy"/>
|
||||
asp-route-id="@titre.IdTitre">
|
||||
@titre.Libelle
|
||||
</a>
|
||||
|
||||
<div class="justify-content-center d-flex flex-column">
|
||||
<div>
|
||||
<a asp-controller="Artiste"
|
||||
asp-action="Index"
|
||||
asp-route-nom="@titre.ArtisteNom">
|
||||
@titre.ArtisteNom
|
||||
</a>
|
||||
-
|
||||
<a asp-controller="Titre"
|
||||
asp-action="Index"
|
||||
asp-route-id="@titre.IdTitre">
|
||||
@titre.Libelle
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
Duree : @TimeSpan.FromSeconds(titre.Duree).ToString(@"mm\:ss")
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
<div>
|
||||
Duree : @TimeSpan.FromSeconds(titre.Duree).ToString(@"mm\:ss")
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
</ul>
|
||||
|
||||
<!-- Barre de recherche -->
|
||||
<form class="d-flex" asp-controller="Recherche" asp-action="Index" method="post">
|
||||
<form class="d-flex" asp-area="" asp-controller="Recherche" asp-action="Index" method="get">
|
||||
<div class="input-group">
|
||||
<div class="form-outline">
|
||||
<input class="form-control me-2"
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
"Seeder": "Local",
|
||||
"Repository": "Db"
|
||||
}
|
||||
|
||||
4
Webzine.WebApplication/appsettings.Production.json
Normal file
4
Webzine.WebApplication/appsettings.Production.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"Seeder": "Local",
|
||||
"Repository": "Db"
|
||||
}
|
||||
@@ -9,11 +9,9 @@
|
||||
"NombreDerniereChronique": 3,
|
||||
"NombreDeTopTitres": 3
|
||||
},
|
||||
"UseDatabase": true,
|
||||
"IsSQLite": true,
|
||||
"ConnectionStrings": {
|
||||
"SqliteConnection": "Data Source=Data/webzine.sqlite",
|
||||
"PostGreSQLConnection" : "Host=localhost;Port=5432;Username=admin;Password=admin123;Database=webzine_db"
|
||||
"PostGreSQLConnection": "Host=localhost;Port=5432;Username=admin;Password=admin123;Database=webzine_db"
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user