diff options
author | terminaldweller <thabogre@gmail.com> | 2022-06-17 17:56:14 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2022-06-17 17:56:14 +0000 |
commit | 4b2a5b8b09b02de9e855a1e5e9a75101d6c334bc (patch) | |
tree | bb33c8ff297e6c9faaa91f43f1191734b05b440a /src/main | |
parent | CORS fix (diff) | |
download | mdrtl-4b2a5b8b09b02de9e855a1e5e9a75101d6c334bc.tar.gz mdrtl-4b2a5b8b09b02de9e855a1e5e9a75101d6c334bc.zip |
added comments
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/terminaldweller/doc/Doc.java | 1 | ||||
-rw-r--r-- | src/main/java/com/terminaldweller/doc/DocService.java | 8 | ||||
-rw-r--r-- | src/main/java/com/terminaldweller/main/DevConfiguration.java | 6 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/com/terminaldweller/doc/Doc.java b/src/main/java/com/terminaldweller/doc/Doc.java index 80247eb..35ee5fd 100644 --- a/src/main/java/com/terminaldweller/doc/Doc.java +++ b/src/main/java/com/terminaldweller/doc/Doc.java @@ -25,6 +25,7 @@ public class Doc { * @param id the id given by the db. * @param name the name of the documment given by the user. * @param lastModified the date of the last modification in unix epoch. + * @param body the actual text of the document. */ public Doc(Long id, String name, long lastModified, String body) { this.id = id; diff --git a/src/main/java/com/terminaldweller/doc/DocService.java b/src/main/java/com/terminaldweller/doc/DocService.java index df4456e..a885b9a 100644 --- a/src/main/java/com/terminaldweller/doc/DocService.java +++ b/src/main/java/com/terminaldweller/doc/DocService.java @@ -14,6 +14,12 @@ public class DocService { this.docRepository = docRepository; } + /** + * get a document by its id. + * + * @param id of the document to get. + * @return returns the found doc if any. + */ public Optional<Doc> getDocs(Long id) { Optional<Doc> docOptional = docRepository.findById(id); if (docOptional.isPresent()) { @@ -26,6 +32,7 @@ public class DocService { * Adds a new Document to the data store. * * @param doc the new Document to add. + * @param id the id of the document that's going to be created. */ public void addNewDoc(Long id, Doc doc) { // Optional<Doc> docOptional = docRepository.findDocByName(doc.getName()); @@ -41,6 +48,7 @@ public class DocService { * Update a Document. * * @param doc the document to update. + * @param id the id of the document to be updated. */ public void updateDoc(Doc doc, Long id) { Optional<Doc> docOptional = docRepository.findById(id); diff --git a/src/main/java/com/terminaldweller/main/DevConfiguration.java b/src/main/java/com/terminaldweller/main/DevConfiguration.java index 0b253df..b63ca7b 100644 --- a/src/main/java/com/terminaldweller/main/DevConfiguration.java +++ b/src/main/java/com/terminaldweller/main/DevConfiguration.java @@ -6,11 +6,17 @@ import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +/** The server config class. */ @Configuration @EnableWebMvc @Profile("development") public class DevConfiguration implements WebMvcConfigurer { + /** + * Configuring CORS headers. + * + * @param registry the registry. + */ @Override public void addCorsMappings(CorsRegistry registry) { registry |