diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..8d6b86b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,162 @@
+# Created by https://www.toptal.com/developers/gitignore/api/maven,intellij,kotlin
+# Edit at https://www.toptal.com/developers/gitignore?templates=maven,intellij,kotlin
+
+### Intellij ###
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/**/usage.statistics.xml
+.idea/**/dictionaries
+.idea/**/shelf
+
+# AWS User-specific
+.idea/**/aws.xml
+
+# Generated files
+.idea/**/contentModel.xml
+
+# Sensitive or high-churn files
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+.idea/**/dbnavigator.xml
+
+# Gradle
+.idea/**/gradle.xml
+.idea/**/libraries
+
+# Gradle and Maven with auto-import
+# When using Gradle or Maven with auto-import, you should exclude module files,
+# since they will be recreated, and may cause churn. Uncomment if using
+# auto-import.
+# .idea/artifacts
+# .idea/compiler.xml
+# .idea/jarRepositories.xml
+# .idea/modules.xml
+# .idea/*.iml
+# .idea/modules
+# *.iml
+# *.ipr
+
+# CMake
+cmake-build-*/
+
+# Mongo Explorer plugin
+.idea/**/mongoSettings.xml
+
+# File-based project format
+*.iws
+
+# IntelliJ
+out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# SonarLint plugin
+.idea/sonarlint/
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+# Editor-based Rest Client
+.idea/httpRequests
+
+# Android studio 3.1+ serialized cache file
+.idea/caches/build_file_checksums.ser
+
+### Intellij Patch ###
+# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
+
+# *.iml
+# modules.xml
+# .idea/misc.xml
+# *.ipr
+
+# Sonarlint plugin
+# https://plugins.jetbrains.com/plugin/7973-sonarlint
+.idea/**/sonarlint/
+
+# SonarQube Plugin
+# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
+.idea/**/sonarIssues.xml
+
+# Markdown Navigator plugin
+# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
+.idea/**/markdown-navigator.xml
+.idea/**/markdown-navigator-enh.xml
+.idea/**/markdown-navigator/
+
+# Cache file creation bug
+# See https://youtrack.jetbrains.com/issue/JBR-2257
+.idea/$CACHE_FILE$
+
+# CodeStream plugin
+# https://plugins.jetbrains.com/plugin/12206-codestream
+.idea/codestream.xml
+
+# Azure Toolkit for IntelliJ plugin
+# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
+.idea/**/azureSettings.xml
+
+### Kotlin ###
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+replay_pid*
+
+### Maven ###
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+# https://github.com/takari/maven-wrapper#usage-without-binary-jar
+.mvn/wrapper/maven-wrapper.jar
+
+# Eclipse m2e generated files
+# Eclipse Core
+.project
+# JDT-specific (Eclipse Java Development Tools)
+.classpath
+
+# End of https://www.toptal.com/developers/gitignore/api/maven,intellij,kotlin
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Readme.md b/Readme.md
index a452039..8918c3c 100644
--- a/Readme.md
+++ b/Readme.md
@@ -1,5 +1,5 @@
# UNQ » UIs » Dominio » Medium
-[](https://jitpack.io/#unq-ui/mercadolibre-model)
+[](https://jitpack.io/#unq-ui/medium-model)
Construcción de Interfaces de Usuario, Universidad Nacional de Quilmes.
@@ -22,7 +22,7 @@ Agregar la dependencia:
com.github.unq-ui
medium-model
- v1.0.0
+ v1.1.0
```
@@ -176,16 +176,11 @@ class User(
val postsSaved: MutableList,
)
-open class Item(val name: String)
-class Title(var data: String): Item("Title")
-class Image(var data: String): Item("Image")
-class Text(var data: String): Item("Text")
-class Quote(var data: String): Item("Quote")
-class Section(
- val title: Title,
- val image: Image?,
- val text: Text,
-): Item("Section")
+open class Item(val name: String, var data: String)
+class Title(data: String): Item("Title", data)
+class Image(data: String): Item("Image", data)
+class Text(data: String): Item("Text", data)
+class Quote(data: String): Item("Quote", data)
class Summary(
var headline: String,
diff --git a/pom.xml b/pom.xml
index fc3b41c..75f7d2c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.github.unq-ui
medium-model
- 1.0.0
+ 1.1.0
jar
org.github.unq-ui medium-model
diff --git a/src/main/kotlin/data/Bootstrap.kt b/src/main/kotlin/data/Bootstrap.kt
index c3811d5..308ed95 100644
--- a/src/main/kotlin/data/Bootstrap.kt
+++ b/src/main/kotlin/data/Bootstrap.kt
@@ -56,11 +56,19 @@ private fun addComments(mediumService: MediumService) {
}
}
+private fun addSavedPosts(mediumService: MediumService) {
+ mediumService.users.take(50).forEach { user ->
+ mediumService.posts.shuffled(random).take(10).forEach { post ->
+ mediumService.toggleSaved(user.id, post.id)
+ }
+ }
+}
fun initSystem(): MediumService {
val mediumService = MediumService()
addUsers(mediumService)
addPosts(mediumService)
addComments(mediumService)
+ addSavedPosts(mediumService)
return mediumService
}
diff --git a/src/main/kotlin/data/Content.kt b/src/main/kotlin/data/Content.kt
index 3541dae..17ace14 100644
--- a/src/main/kotlin/data/Content.kt
+++ b/src/main/kotlin/data/Content.kt
@@ -4,25 +4,18 @@ import model.*
val allContent = listOf(
Text("One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The bedding was hardly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked. \"What's happened to me?\" he thought. It wasn't a dream. His room, a proper human"),
- Section(
- Title("DJs flock by when MTV"),
- null,
- Text("The quick, brown fox jumps over a lazy dog. DJs flock by when MTV ax quiz prog. Junk MTV quiz graced by fox whelps. Bawds jog, flick quartz, vex nymphs. Waltz, bad nymph, for quick jigs vex! Fox nymphs grab quick-jived waltz. Brick quiz whangs jumpy veldt fox. Bright vixens jump; dozy fowl quack. Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! \"Now fax quiz Jack!\" my brave"),
- ),
+ Title("DJs flock by when MTV"),
+ Text("The quick, brown fox jumps over a lazy dog. DJs flock by when MTV ax quiz prog. Junk MTV quiz graced by fox whelps. Bawds jog, flick quartz, vex nymphs. Waltz, bad nymph, for quick jigs vex! Fox nymphs grab quick-jived waltz. Brick quiz whangs jumpy veldt fox. Bright vixens jump; dozy fowl quack. Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! \"Now fax quiz Jack!\" my brave"),
Text("The quick, brown fox jumps over a lazy dog. DJs flock by when MTV ax quiz prog. Junk MTV quiz graced by fox whelps. Bawds jog, flick quartz, vex nymphs. Waltz, bad nymph, for quick jigs vex! Fox nymphs grab quick-jived waltz. Brick quiz whangs jumpy veldt fox. Bright vixens jump; dozy fowl quack. Quick wafting zephyrs vex bold Jim. Quick zephyrs blow, vexing daft Jim. Sex-charged fop blew my junk TV quiz. How quickly daft jumping zebras vex. Two driven jocks help fax my big quiz. Quick, Baz, get my woven flax jodhpurs! \"Now fax quiz Jack!\" my brave"),
Text("The European languages are members of the same family. Their separate existence is a myth. For science, music, sport, etc, Europe uses the same vocabulary. The languages only differ in their grammar, their pronunciation and their most common words. Everyone realizes why a new common language would be desirable: one could refuse to pay expensive translators. To achieve this, it would be necessary to have uniform grammar, pronunciation and more common words. If several languages coalesce, the grammar of the resulting language is more simple and regular than that of the individual languages. The new common language will be"),
Text("Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however"),
Text("A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with"),
- Section(
- Title("The Big Oxmox"),
- Image("https://cdn.dummyjson.com/products/images/beauty/Essence%20Mascara%20Lash%20Princess/1.png"),
- Text("The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen. She packed her seven versalia, put her initial into the belt and made herself on the way. When she reached the first hills of the Italic Mountains, she had a last view back on the skyline of her hometown Bookmarksgrove, the headline of Alphabet Village and the subline of her own road, the Line Lane. Pityful a rethoric question ran over her cheek, then she continued her way. On her way she met a copy.")
- ),
- Section(
- Title("The European languages"),
- Image("https://cdn.dummyjson.com/products/images/beauty/Eyeshadow%20Palette%20with%20Mirror/1.png"),
- Text("It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer. Gregor then turned to look out the window at the dull weather. Drops of rain could be heard hitting the pane, which made him feel quite sad. \"How about if I sleep a little bit longer and forget all this nonsense\", he thought, but that was something he was unable to do because he was used to sleeping on his right, and in his present state couldn't get into that position. However hard he threw himself onto his right, he always rolled back to where he was. He must have tried it a hundred times, shut his eyes so that he wouldn't have to look at the floundering legs, and only stopped when he began to feel a mild, dull pain there that he had never felt before.")
- ),
+ Title("The Big Oxmox"),
+ Image("https://cdn.dummyjson.com/products/images/beauty/Essence%20Mascara%20Lash%20Princess/1.png"),
+ Text("The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen. She packed her seven versalia, put her initial into the belt and made herself on the way. When she reached the first hills of the Italic Mountains, she had a last view back on the skyline of her hometown Bookmarksgrove, the headline of Alphabet Village and the subline of her own road, the Line Lane. Pityful a rethoric question ran over her cheek, then she continued her way. On her way she met a copy."),
+ Title("The European languages"),
+ Image("https://cdn.dummyjson.com/products/images/beauty/Eyeshadow%20Palette%20with%20Mirror/1.png"),
+ Text("It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer. Gregor then turned to look out the window at the dull weather. Drops of rain could be heard hitting the pane, which made him feel quite sad. \"How about if I sleep a little bit longer and forget all this nonsense\", he thought, but that was something he was unable to do because he was used to sleeping on his right, and in his present state couldn't get into that position. However hard he threw himself onto his right, he always rolled back to where he was. He must have tried it a hundred times, shut his eyes so that he wouldn't have to look at the floundering legs, and only stopped when he began to feel a mild, dull pain there that he had never felt before."),
Text("But nothing the copy said could convince her and so it didn’t take long until a few insidious Copy Writers ambushed her, made her drunk with Longe and Parole and dragged her into their agency, where they abused her for their projects again and again. And if she hasn’t been rewritten, then they are still using her. Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however"),
Text("Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex"),
Text("Elon Musk's Tesla, one of the biggest corporate owners of bitcoin (BTC), transferred nearly all \$760 million of the cryptocurrency it owns to unknown wallets, raising the possibility the carmaker is selling. Wallets associated with the electric car manufacturer on Tuesday moved more than 11,500 bitcoin to wallets whose ownership is unknown, according to crypto data firm Arkham Intelligence. The Tesla wallets only retain about \$6.65 worth of BTC – essentially nothing."),
diff --git a/src/main/kotlin/model/DataClasses.kt b/src/main/kotlin/model/DataClasses.kt
index 72a9f9d..70f4848 100644
--- a/src/main/kotlin/model/DataClasses.kt
+++ b/src/main/kotlin/model/DataClasses.kt
@@ -20,16 +20,11 @@ class User(
val postsSaved: MutableList,
)
-open class Item(val name: String)
-class Title(var data: String): Item("Title")
-class Image(var data: String): Item("Image")
-class Text(var data: String): Item("Text")
-class Quote(var data: String): Item("Quote")
-class Section(
- val title: Title,
- val image: Image?,
- val text: Text,
-): Item("Section")
+open class Item(val name: String, var data: String)
+class Title(data: String): Item("Title", data)
+class Image(data: String): Item("Image", data)
+class Text(data: String): Item("Text", data)
+class Quote(data: String): Item("Quote", data)
class Summary(
var headline: String,
diff --git a/src/main/kotlin/service/MediumService.kt b/src/main/kotlin/service/MediumService.kt
index c002d74..d5ea777 100644
--- a/src/main/kotlin/service/MediumService.kt
+++ b/src/main/kotlin/service/MediumService.kt
@@ -91,7 +91,6 @@ class MediumService {
*/
fun promoteUserToAdmin(idUser: String): User {
val user = getUser(idUser)
- checkIfUserIsAdmin(user)
user.role = AdminRole()
return user
}
diff --git a/target/classes/META-INF/medium-model.kotlin_module b/target/classes/META-INF/medium-model.kotlin_module
deleted file mode 100644
index 88fddb6..0000000
Binary files a/target/classes/META-INF/medium-model.kotlin_module and /dev/null differ
diff --git a/target/classes/data/BootstrapKt.class b/target/classes/data/BootstrapKt.class
deleted file mode 100644
index de57c2e..0000000
Binary files a/target/classes/data/BootstrapKt.class and /dev/null differ
diff --git a/target/classes/data/CommentsKt.class b/target/classes/data/CommentsKt.class
deleted file mode 100644
index 71d4217..0000000
Binary files a/target/classes/data/CommentsKt.class and /dev/null differ
diff --git a/target/classes/data/ContentKt.class b/target/classes/data/ContentKt.class
deleted file mode 100644
index a929fc3..0000000
Binary files a/target/classes/data/ContentKt.class and /dev/null differ
diff --git a/target/classes/data/SummariesKt.class b/target/classes/data/SummariesKt.class
deleted file mode 100644
index 4750eb5..0000000
Binary files a/target/classes/data/SummariesKt.class and /dev/null differ
diff --git a/target/classes/data/UserJSON.class b/target/classes/data/UserJSON.class
deleted file mode 100644
index d34b550..0000000
Binary files a/target/classes/data/UserJSON.class and /dev/null differ
diff --git a/target/classes/data/UsersKt.class b/target/classes/data/UsersKt.class
deleted file mode 100644
index 89a4fdc..0000000
Binary files a/target/classes/data/UsersKt.class and /dev/null differ
diff --git a/target/classes/model/AdminRole.class b/target/classes/model/AdminRole.class
deleted file mode 100644
index dfc3b00..0000000
Binary files a/target/classes/model/AdminRole.class and /dev/null differ
diff --git a/target/classes/model/Comment.class b/target/classes/model/Comment.class
deleted file mode 100644
index baa7b23..0000000
Binary files a/target/classes/model/Comment.class and /dev/null differ
diff --git a/target/classes/model/CommentException.class b/target/classes/model/CommentException.class
deleted file mode 100644
index d350090..0000000
Binary files a/target/classes/model/CommentException.class and /dev/null differ
diff --git a/target/classes/model/DraftNewUser.class b/target/classes/model/DraftNewUser.class
deleted file mode 100644
index 09710ad..0000000
Binary files a/target/classes/model/DraftNewUser.class and /dev/null differ
diff --git a/target/classes/model/DraftPost.class b/target/classes/model/DraftPost.class
deleted file mode 100644
index d809184..0000000
Binary files a/target/classes/model/DraftPost.class and /dev/null differ
diff --git a/target/classes/model/IdGenerator.class b/target/classes/model/IdGenerator.class
deleted file mode 100644
index fa675a7..0000000
Binary files a/target/classes/model/IdGenerator.class and /dev/null differ
diff --git a/target/classes/model/Image.class b/target/classes/model/Image.class
deleted file mode 100644
index c4e97cf..0000000
Binary files a/target/classes/model/Image.class and /dev/null differ
diff --git a/target/classes/model/Item.class b/target/classes/model/Item.class
deleted file mode 100644
index 8a3d8c3..0000000
Binary files a/target/classes/model/Item.class and /dev/null differ
diff --git a/target/classes/model/MediumRole.class b/target/classes/model/MediumRole.class
deleted file mode 100644
index 47c9e5b..0000000
Binary files a/target/classes/model/MediumRole.class and /dev/null differ
diff --git a/target/classes/model/PageException.class b/target/classes/model/PageException.class
deleted file mode 100644
index 1281e58..0000000
Binary files a/target/classes/model/PageException.class and /dev/null differ
diff --git a/target/classes/model/Post.class b/target/classes/model/Post.class
deleted file mode 100644
index 20d8748..0000000
Binary files a/target/classes/model/Post.class and /dev/null differ
diff --git a/target/classes/model/PostException.class b/target/classes/model/PostException.class
deleted file mode 100644
index ed99ef4..0000000
Binary files a/target/classes/model/PostException.class and /dev/null differ
diff --git a/target/classes/model/Quote.class b/target/classes/model/Quote.class
deleted file mode 100644
index 812fd90..0000000
Binary files a/target/classes/model/Quote.class and /dev/null differ
diff --git a/target/classes/model/Section.class b/target/classes/model/Section.class
deleted file mode 100644
index 7f152b2..0000000
Binary files a/target/classes/model/Section.class and /dev/null differ
diff --git a/target/classes/model/Summary.class b/target/classes/model/Summary.class
deleted file mode 100644
index ffc2d17..0000000
Binary files a/target/classes/model/Summary.class and /dev/null differ
diff --git a/target/classes/model/Text.class b/target/classes/model/Text.class
deleted file mode 100644
index 7a0bd30..0000000
Binary files a/target/classes/model/Text.class and /dev/null differ
diff --git a/target/classes/model/Title.class b/target/classes/model/Title.class
deleted file mode 100644
index 42c4595..0000000
Binary files a/target/classes/model/Title.class and /dev/null differ
diff --git a/target/classes/model/User.class b/target/classes/model/User.class
deleted file mode 100644
index ec9f73b..0000000
Binary files a/target/classes/model/User.class and /dev/null differ
diff --git a/target/classes/model/UserException.class b/target/classes/model/UserException.class
deleted file mode 100644
index 6647abd..0000000
Binary files a/target/classes/model/UserException.class and /dev/null differ
diff --git a/target/classes/model/UserRole.class b/target/classes/model/UserRole.class
deleted file mode 100644
index b4c14ac..0000000
Binary files a/target/classes/model/UserRole.class and /dev/null differ
diff --git a/target/classes/service/MediumService.class b/target/classes/service/MediumService.class
deleted file mode 100644
index 0255e0b..0000000
Binary files a/target/classes/service/MediumService.class and /dev/null differ
diff --git a/target/classes/utilities/Page.class b/target/classes/utilities/Page.class
deleted file mode 100644
index 9a6b42f..0000000
Binary files a/target/classes/utilities/Page.class and /dev/null differ
diff --git a/target/classes/utilities/PageKt.class b/target/classes/utilities/PageKt.class
deleted file mode 100644
index 57e69ce..0000000
Binary files a/target/classes/utilities/PageKt.class and /dev/null differ