NodeJS/Express JS, JavaScript/TypeScript, MongoDB
Implement functionality to create a product with the following attributes:
Product codes must be auto-generated based on the product name with the following steps:
Extract the longest strictly increasing substring (consecutive letters in alphabetical order and lowercase).
If multiple substrings of equal length exist, concatenate them.
Append the starting and ending index of the substring in the product name.
Add the hashed value of the product name at the beginning as a prefix with a dash (-).
Format: The final product code should follow this structure:
<hashed product name>-<start_index><substring><end_index>