Skip to content

Port of Junjo to KOTLIN for training purposes

Notifications You must be signed in to change notification settings

pmarquez/junjo-kt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


logo

A simple sequence generator.

Meaning sequence in Japanese, junjo is a microservice that returns the next code in, well, a sequence or series.

contributors last update stars open issues license


Overview

junjo keeps a collection of sequence definitions that can be invoked in order to obtain one or more values from a specific sequence, identified by its sequenceId.

A typical sequence pattern may look like SKU-{AAA}-{NNNN}-{YYYY}, where:

  • SKU is a text literal.
    • {AAA} represents an alphanumeric sequence [ABC, ABD, ABE, ABF, etc.]
  • {NNNN} represents a numeric sequence [0001, 0002, 0003, 0004, etc.] (left padded with zeroes)
  • {YYYY} represents the current year. [2022]

So, a value generated by the above example, would look like: SKU-UEJ-0432-2022

Tech Stack

Issues

https://github.com/pmarquez/junjo-kt/issues

OpenAPI Doc

https://github.com/pmarquez/junjo-kt/blob/main/junjoAPI.yaml

Docker Repo

docker pull pmarquezh/junjo

Creating a new sequence

Endpoint:

/junjoAPI/1.0/sequences

Method:

POST

Body:

The endpoint expects a DTO with the following internal structure:

{
  "sequenceName": "SKUs",
  "pattern": "{AAA}-{NNNN}",
  "currentNumericSequence": 0,
  "currentAlphaSequence": 0,
  "currentAlphaRepresentation": "AAA",
  "priorityType": "numeric"
}

Where...

  "sequenceName" is the human readable name of the sequence to create. Must be unique.
  
  "pattern" is the format of the sequence elements, more on it on the "patterns" section

  "currentNumericSequence" is the current value of the numeric segment of the pattern (if any). This value, when used to generate an element in a sequence, will be left-padded with zeroes ("0") to match the length of the pattern segment.

  "currentAlphaSequence" even though the alpha segment of a pattern will return, well, an alpha sequence, it's internal representation will be a number.

  "currentAlphaRepresentation" the currentAlphaRepresentation is a nicety for us humans to see at a glance what the currentAlphaSequence means in terms of its alpha representation.

  "priorityType", what will increment first? numeric? alpha? if "numeric", a sequence with a {AAA}-{NNN} pattern and a current value of "AAA-999", will return "AAB-000" as the next value, if "alpha", the next value would be "AAB-999".

Return:

This endpoint will return, in the "Location" header, the sequenceId id of the newly created sequence, which is a UUID of the form: "4a0316d6-2c1a-4a68-b904-5fba89a4f346"

Release Notes

v0.9.13-SNAPSHOT

* SequenceServiceImpl cleanup.
* MySQL repository - First Blood

v0.9.12-SNAPSHOT

* Reviewed code in SequenceRestController, many new things learned since last time, code improvements, many more to come.

v0.9.11.1-SNAPSHOT

* Updated dependencies in preparation to integrate with nsOmnistore

v0.9.11-SNAPSHOT

* A bit of cleanup and db schema added to project

v0.9.10-SNAPSHOT

  • Numeric rollover fixed.

v0.9.9-SNAPSHOT

  • Constraint Validations now working
  • Filters now done the KOTLIN way

v0.9.8-SNAPSHOT

  • Kotlin port

About

Port of Junjo to KOTLIN for training purposes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published