Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jmottesi committed Oct 17, 2024
1 parent 146c384 commit 63d1ae7
Show file tree
Hide file tree
Showing 38 changed files with 197 additions and 39 deletions.
162 changes: 162 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 7 additions & 12 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# UNQ » UIs » Dominio » Medium
[![](https://jitpack.io/v/unq-ui/mercadolibre-model.svg)](https://jitpack.io/#unq-ui/mercadolibre-model)
[![](https://jitpack.io/v/unq-ui/medium-model.svg)](https://jitpack.io/#unq-ui/medium-model)

Construcción de Interfaces de Usuario, Universidad Nacional de Quilmes.

Expand All @@ -22,7 +22,7 @@ Agregar la dependencia:
<dependency>
<groupId>com.github.unq-ui</groupId>
<artifactId>medium-model</artifactId>
<version>v1.0.0</version>
<version>v1.1.0</version>
</dependency>
```

Expand Down Expand Up @@ -176,16 +176,11 @@ class User(
val postsSaved: MutableList<Post>,
)

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,
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.github.unq-ui</groupId>
<artifactId>medium-model</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
<packaging>jar</packaging>

<name>org.github.unq-ui medium-model</name>
Expand Down
8 changes: 8 additions & 0 deletions src/main/kotlin/data/Bootstrap.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
23 changes: 8 additions & 15 deletions src/main/kotlin/data/Content.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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."),
Expand Down
15 changes: 5 additions & 10 deletions src/main/kotlin/model/DataClasses.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,11 @@ class User(
val postsSaved: MutableList<Post>,
)

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,
Expand Down
1 change: 0 additions & 1 deletion src/main/kotlin/service/MediumService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ class MediumService {
*/
fun promoteUserToAdmin(idUser: String): User {
val user = getUser(idUser)
checkIfUserIsAdmin(user)
user.role = AdminRole()
return user
}
Expand Down
Binary file removed target/classes/META-INF/medium-model.kotlin_module
Binary file not shown.
Binary file removed target/classes/data/BootstrapKt.class
Binary file not shown.
Binary file removed target/classes/data/CommentsKt.class
Binary file not shown.
Binary file removed target/classes/data/ContentKt.class
Binary file not shown.
Binary file removed target/classes/data/SummariesKt.class
Binary file not shown.
Binary file removed target/classes/data/UserJSON.class
Binary file not shown.
Binary file removed target/classes/data/UsersKt.class
Binary file not shown.
Binary file removed target/classes/model/AdminRole.class
Binary file not shown.
Binary file removed target/classes/model/Comment.class
Binary file not shown.
Binary file removed target/classes/model/CommentException.class
Binary file not shown.
Binary file removed target/classes/model/DraftNewUser.class
Binary file not shown.
Binary file removed target/classes/model/DraftPost.class
Binary file not shown.
Binary file removed target/classes/model/IdGenerator.class
Binary file not shown.
Binary file removed target/classes/model/Image.class
Binary file not shown.
Binary file removed target/classes/model/Item.class
Binary file not shown.
Binary file removed target/classes/model/MediumRole.class
Binary file not shown.
Binary file removed target/classes/model/PageException.class
Binary file not shown.
Binary file removed target/classes/model/Post.class
Binary file not shown.
Binary file removed target/classes/model/PostException.class
Binary file not shown.
Binary file removed target/classes/model/Quote.class
Binary file not shown.
Binary file removed target/classes/model/Section.class
Binary file not shown.
Binary file removed target/classes/model/Summary.class
Binary file not shown.
Binary file removed target/classes/model/Text.class
Binary file not shown.
Binary file removed target/classes/model/Title.class
Binary file not shown.
Binary file removed target/classes/model/User.class
Binary file not shown.
Binary file removed target/classes/model/UserException.class
Binary file not shown.
Binary file removed target/classes/model/UserRole.class
Binary file not shown.
Binary file removed target/classes/service/MediumService.class
Binary file not shown.
Binary file removed target/classes/utilities/Page.class
Binary file not shown.
Binary file removed target/classes/utilities/PageKt.class
Binary file not shown.

0 comments on commit 63d1ae7

Please sign in to comment.