Skip to content

Commit

Permalink
Push works
Browse files Browse the repository at this point in the history
  • Loading branch information
cheroliv committed Sep 27, 2024
1 parent 2c104f4 commit 03e24b8
Show file tree
Hide file tree
Showing 16 changed files with 1,630 additions and 29 deletions.
1 change: 0 additions & 1 deletion application/app/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
INSTALL_PATH = ""



class TestCLI(unittest.TestCase):
def test_greetings(self):
print(f"test cli : greetings!")
Expand Down
17 changes: 16 additions & 1 deletion springboot/api/src/main/kotlin/webapp/users/User.kt
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ data class User(
.trimMargin()



//TODO: signup, findByEmailOrLogin,
}

object Dao {
val Pair<User, ApplicationContext>.toJson: String
get() = second.getBean<ObjectMapper>().writeValueAsString(first)
Expand All @@ -156,4 +156,19 @@ data class User(
}
}
}
/** Account REST API URIs */
object UserRestApis {
const val API_AUTHORITY = "/api/authorities"
const val API_USERS = "/api/users"
const val API_SIGNUP = "/signup"
const val API_SIGNUP_PATH = "$API_USERS$API_SIGNUP"
const val API_ACTIVATE = "/activate"
const val API_ACTIVATE_PATH = "$API_USERS$API_ACTIVATE?key="
const val API_ACTIVATE_PARAM = "{activationKey}"
const val API_ACTIVATE_KEY = "key"
const val API_RESET_INIT = "/reset-password/init"
const val API_RESET_FINISH = "/reset-password/finish"
const val API_CHANGE = "/change-password"
const val API_CHANGE_PATH = "$API_USERS$API_CHANGE"
}
}
208 changes: 208 additions & 0 deletions springboot/api/src/main/kotlin/webapp/users/signup/Account.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
//@file:Suppress("unused")
//
//package webapp.users.signup
//
//import jakarta.validation.constraints.Email
//import jakarta.validation.constraints.NotBlank
//import jakarta.validation.constraints.Pattern
//import jakarta.validation.constraints.Size
//import org.springframework.web.server.ServerWebExchange
//import webapp.core.http.validator
//import java.time.Instant
//import java.util.*
//
///**
// * Représente l'account domain model sans le password
// */
////TODO: add field enabled=false
//data class Account(
// val id: UUID? = null,
// @field:NotBlank
// @field:Pattern(regexp = LOGIN_REGEX)
// @field:Size(min = 1, max = 50)
// val login: String? = null,
// @field:Size(max = 50)
// val firstName: String? = null,
// @field:Size(max = 50)
// val lastName: String? = null,
// @field:Email
// @field:Size(min = 5, max = 254)
// val email: String? = null,
// @field:Size(max = 256)
// val imageUrl: String? = IMAGE_URL_DEFAULT,
// val activated: Boolean = false,
// @field:Size(min = 2, max = 10)
// val langKey: String? = null,
// val createdBy: String? = null,
// val createdDate: Instant? = null,
// val lastModifiedBy: String? = null,
// val lastModifiedDate: Instant? = null,
// val authorities: Set<String>? = null
//){
// companion object {
// const val IMAGE_URL_DEFAULT = "http://placehold.it/50x50"
// // Regex for acceptable logins
// const val LOGIN_REGEX =
// "^(?>[a-zA-Z0-9!$&*+=?^_`{|}~.-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*)|(?>[_.@A-Za-z0-9-]+)$"
// const val PASSWORD_MIN: Int = 4
// const val PASSWORD_MAX: Int = 16
// @JvmStatic
// val objectName: String = Account::class
// .java
// .simpleName
// .run {
// replaceFirst(
// first(),
// first().lowercaseChar()
// )
// }
// const val LOGIN_FIELD = "login"
// const val PASSWORD_FIELD = "password"
// const val EMAIL_FIELD = "email"
// const val ACCOUNT_AUTH_USER_ID_FIELD = "userId"
// const val ACTIVATION_KEY_FIELD = "activationKey"
// const val RESET_KEY_FIELD = "resetKey"
// const val FIRST_NAME_FIELD = "firstName"
// const val LAST_NAME_FIELD = "lastName"
// }
//}
//
//fun Account.isActivated(): Boolean = activated
//
//fun Account.validate(
// fields: Set<String>,
// //si le validateur est null alors injecter celui du context
// // mais faire cela a l'appel de la methode validate
// //faire une extension function getValidator(exchange: ServerWebExchange?=null)
// exchange: ServerWebExchange?, //Pair<ApplicationContext,ServerWebExchange>
// //si les deux sont null contruire soit meme le validator par defaut
//) = exchange.apply {
// if (this == null) return emptySet<Map<String, String>>()
//}!!.validator.run {
// fields.map { field ->
// field to validateProperty(this@validate, field)
// }.flatMap { violatedField ->
// violatedField.second.map {
// mapOf(
// "objectName" to Account.objectName,
// "field" to violatedField.first,
// "message" to it.message
// )
// }
// }.toSet()
//}
//
////fun Account.validate(
//// fields: Set<String>,
//// //si le validateur est null alors injecter celui du context
//// // mais faire cela a l'appel de la methode validate
//// //faire une extension function getValidator(exchange: ServerWebExchange?=null)
//// exchange: ServerWebExchange?, //Pair<ApplicationContext,ServerWebExchange>
//// //si les deux sont null contruire soit meme le validator par defaut
////) = exchange.apply {
//// if (this == null) return emptySet<Map<String, String>>()
////}!!.validator.run {
//// fields.map { field ->
//// field to validateProperty(this@validate, field)
//// }.flatMap { violatedField ->
//// violatedField.second.map {
//// mapOf(
//// "objectName" to Account.objectName,
//// "field" to violatedField.first,
//// "message" to it.message
//// )
//// }
//// }.toSet()
////}
//
//
////@file:Suppress("unused")
////
////package community.accounts
////
////import community.core.http.validator
////import jakarta.validation.constraints.Email
////import jakarta.validation.constraints.NotBlank
////import jakarta.validation.constraints.Pattern
////import jakarta.validation.constraints.Size
////import org.springframework.web.server.ServerWebExchange
////import java.time.Instant
////import java.util.*
////
/////**
//// * Représente l'account domain model avec le password et l'activationKey
//// * pour la vue
//// */
////data class Account(
//// val id: UUID? = null,
//// @field:NotBlank
//// @field:Pattern(regexp = LOGIN_REGEX)
//// @field:Size(min = 1, max = 50)
//// val login: String? = null,
//// @field:Email
//// @field:Size(min = 5, max = 254)
//// val email: String? = null,
//// @field:Size(max = 50)
//// val firstName: String? = null,
//// @field:Size(max = 50)
//// val lastName: String? = null,
//// @field:Size(min = 2, max = 10)
//// val langKey: String? = null,
//// @field:Size(max = 256)
//// val imageUrl: String? = IMAGE_URL_DEFAULT,
//// val createdBy: String? = null,
//// val createdDate: Instant? = null,
//// val lastModifiedBy: String? = null,
//// val lastModifiedDate: Instant? = null,
//// val authorities: Set<String>? = null
////) {
//// companion object {
//// const val IMAGE_URL_DEFAULT = "http://placehold.it/50x50"
//// // Regex for acceptable logins
//// const val LOGIN_REGEX =
//// "^(?>[a-zA-Z0-9!$&*+=?^_`{|}~.-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*)|(?>[_.@A-Za-z0-9-]+)$"
//// const val PASSWORD_MIN: Int = 4
//// const val PASSWORD_MAX: Int = 16
//// @JvmStatic
//// val objectName: String = Account::class
//// .java
//// .simpleName
//// .run {
//// replaceFirst(
//// first(),
//// first().lowercaseChar()
//// )
//// }
//// const val LOGIN_FIELD = "login"
//// const val PASSWORD_FIELD = "password"
//// const val EMAIL_FIELD = "email"
//// const val ACCOUNT_AUTH_USER_ID_FIELD = "userId"
//// const val ACTIVATION_KEY_FIELD = "activationKey"
//// const val RESET_KEY_FIELD = "resetKey"
//// const val FIRST_NAME_FIELD = "firstName"
//// const val LAST_NAME_FIELD = "lastName"
//// }
////}
////
////fun Account.validate(
//// fields: Set<String>,
//// //si le validateur est null alors injecter celui du context
//// // mais faire cela a l'appel de la methode validate
//// //faire une extension function getValidator(exchange: ServerWebExchange?=null)
//// exchange: ServerWebExchange?, //Pair<ApplicationContext,ServerWebExchange>
//// //si les deux sont null contruire soit meme le validator par defaut
////) = exchange.apply {
//// if (this == null) return emptySet<Map<String, String>>()
////}!!.validator.run {
//// fields.map { field ->
//// field to validateProperty(this@validate, field)
//// }.flatMap { violatedField ->
//// violatedField.second.map {
//// mapOf(
//// "objectName" to Account.objectName,
//// "field" to violatedField.first,
//// "message" to it.message
//// )
//// }
//// }.toSet()
////}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
//@file:Suppress("unused")
//
//package webapp.users.signup
//
//import jakarta.validation.constraints.*
//import webapp.core.property.IMAGE_URL_DEFAULT
//import webapp.core.property.LOGIN_REGEX
//import webapp.core.property.PASSWORD_MAX
//import webapp.core.property.PASSWORD_MIN
//import webapp.accounts.models.AccountUtils.objectName
//import java.time.Instant
//import java.util.*
//
///**
// * Représente l'account domain model avec le password et l'activationKey
// * pour la vue
// */
//data class AccountCredentials(
// val id: UUID? = null,
// @field:Size(min = PASSWORD_MIN, max = PASSWORD_MAX)
// @field:NotNull
// val password: String? = null,
// @field:NotBlank
// @field:Pattern(regexp = LOGIN_REGEX)
// @field:Size(min = 1, max = 50)
// val login: String? = null,
// @field:Email
// @field:Size(min = 5, max = 254)
// val email: String? = null,
// @field:Size(max = 50)
// val firstName: String? = null,
// @field:Size(max = 50)
// val lastName: String? = null,
// @field:Size(min = 2, max = 10)
// val langKey: String? = null,
// @field:Size(max = 256)
// val imageUrl: String? = IMAGE_URL_DEFAULT,
// val activationKey: String? = null,
// val resetKey: String? = null,
// val activated: Boolean = false,
// val createdBy: String? = null,
// val createdDate: Instant? = null,
// val lastModifiedBy: String? = null,
// val lastModifiedDate: Instant? = null,
// val authorities: Set<String>? = null
//) {
//
// constructor(account: Account) : this(
// id = account.id,
// login = account.login,
// email = account.email,
// firstName = account.firstName,
// lastName = account.lastName,
// langKey = account.langKey,
// activated = account.activated,
// createdBy = account.createdBy,
// createdDate = account.createdDate,
// lastModifiedBy = account.lastModifiedBy,
// lastModifiedDate = account.lastModifiedDate,
// imageUrl = account.imageUrl,
// authorities = account.authorities?.map { it }?.toMutableSet()
// )
//
// companion object {
// @JvmStatic
// val objectName = AccountCredentials::class.java.simpleName.objectName
// }
//}
//
//
//fun AccountCredentials.toAccount(): Account = Account(
// id = id,
// login = login,
// firstName = firstName,
// lastName = lastName,
// email = email,
// activated = activated,
// langKey = langKey,
// createdBy = createdBy,
// createdDate = createdDate,
// lastModifiedBy = lastModifiedBy,
// lastModifiedDate = lastModifiedDate,
// authorities = authorities
//)
//
17 changes: 17 additions & 0 deletions springboot/api/src/main/kotlin/webapp/users/signup/AccountExtra.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//package webapp.users.signup
//
//import java.time.Instant
//import java.util.*
//
//data class AccountExtra(
// val password: String,
// val enabled: Boolean = false,
// val activationKey: String?,
// val resetKey: String? = null,
// val resetDate: Instant? = null,
// val createdBy: UUID,
// val lastModifiedBy: UUID,
//)
//
//
//
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//package webapp.users.signup
//
//data class AccountFull(
// val account: Account,
// val accountExtra: AccountExtra,
//)
//

This file was deleted.

Loading

0 comments on commit 03e24b8

Please sign in to comment.