Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
cebd6a2
adding script and new fields in table, also adding enum for collectio…
jchavez137 Jan 27, 2023
7cdf540
correcting enum status type and script, also renaming owner field to …
jchavez137 Jan 27, 2023
2c35fcd
Added the new db columns to the collection DAO and Doc
wgu-edwin Jan 30, 2023
6382208
Add my workspace in header
manuel-delvillar Jan 27, 2023
75d0396
Add my workspace component
manuel-delvillar Jan 27, 2023
591f050
Working on submenu in button
manuel-delvillar Jan 27, 2023
472b446
Update super constructor
manuel-delvillar Jan 27, 2023
ea41d5d
Update tests
manuel-delvillar Jan 27, 2023
80b283f
Update ITableActionDefinitionSubMenu
manuel-delvillar Jan 27, 2023
47186e9
Add test
manuel-delvillar Jan 30, 2023
be3ec4b
Workspace actions
manuel-delvillar Jan 30, 2023
5e7f870
Update PublishStatus.ts
manuel-delvillar Jan 31, 2023
ada1a83
returning to use PublishStatus as Enum for Collection status
jchavez137 Feb 1, 2023
6f74832
adding logic to avoid nulls in status for collection, adding owner fi…
jchavez137 Feb 1, 2023
f21737e
adding logic to populate owner field depending on the param passed wh…
jchavez137 Feb 1, 2023
b637867
adding logic to populate owner field depending on the param passed wh…
jchavez137 Feb 1, 2023
c5b7f34
Start fixing unit testing
jchavez137 Feb 1, 2023
a290db4
Fixing unit testing
jchavez137 Feb 1, 2023
a84461b
Fixing Enum mapping
jchavez137 Feb 2, 2023
28c9ea0
Adding workspace endpoint to be retrieved.
jchavez137 Feb 2, 2023
33820d8
removing whitespaces, refactoring getter
jchavez137 Feb 2, 2023
2383133
refactoring WS endpoint to retrieve the default one per user o create…
jchavez137 Feb 2, 2023
7ddabc6
refactoring null
jchavez137 Feb 2, 2023
0debcb6
Simulated workspace
manuel-delvillar Jan 31, 2023
4ef37ae
Update my workspace tests
manuel-delvillar Feb 1, 2023
475775f
Using end point get workspace
manuel-delvillar Feb 2, 2023
32861ce
Add test add to workspace
manuel-delvillar Feb 2, 2023
4b0defc
clearing owner field after changing status of a workspace
jchavez137 Feb 2, 2023
29cbef7
setting status field as null-checked in ApiCollection
jchavez137 Feb 3, 2023
6ff7758
Using pipe collection
manuel-delvillar Feb 3, 2023
75b4c9e
Remove set status workspace
manuel-delvillar Feb 3, 2023
e3a8e87
Create collection from workspace
manuel-delvillar Feb 3, 2023
e5300f9
Index pipes
manuel-delvillar Feb 3, 2023
99ae35b
Add pipe test
manuel-delvillar Feb 3, 2023
fe6ffcc
adding ES filtering for the Richskill to not display the Workspace in…
jchavez137 Feb 3, 2023
63e3bdf
refactoring workspace check on Collection
jchavez137 Feb 7, 2023
df024f4
securing workspace endpoint to be accessible by admins and curators only
jchavez137 Feb 7, 2023
d0040a8
Add collection pipe on templates
manuel-delvillar Feb 3, 2023
7eaf879
Disable actions my workspace & confirm message
manuel-delvillar Feb 7, 2023
849d0af
Only admin and curator can see workspace
manuel-delvillar Feb 7, 2023
e7ae7b4
setting case-insensitive when deserializing the enum status field fro…
jchavez137 Feb 8, 2023
0fef6eb
enabling skills update endpoint for curator role
jchavez137 Feb 9, 2023
511580e
adding unit test for CollectionController workspace endpoint
jchavez137 Feb 9, 2023
4c904e1
reverting mock-data xml file
jchavez137 Feb 9, 2023
b0a7b7f
Download as CSV visibility & test
manuel-delvillar Feb 8, 2023
f720714
Hide collection label
manuel-delvillar Feb 8, 2023
a70777b
Hide audit log
manuel-delvillar Feb 8, 2023
92f9c82
Convert publish status enum to lower case.
manuel-delvillar Feb 8, 2023
aa32926
Curator can use workspace
manuel-delvillar Feb 9, 2023
da5d6d1
Add convert to collection component
manuel-delvillar Feb 9, 2023
5f60c37
Add tests workspace
manuel-delvillar Feb 9, 2023
d89309f
Correcting mock xml record
jchavez137 Feb 10, 2023
20bb143
testing remote fix for mock xml record
jchavez137 Feb 10, 2023
c353de3
testing remote fix for mock xml record
jchavez137 Feb 10, 2023
281185f
testing remote fix for mock xml record
jchavez137 Feb 10, 2023
9181cba
Update tests workspace
manuel-delvillar Feb 10, 2023
ebd25cb
Remove undesired changes
manuel-delvillar Feb 10, 2023
63c9589
Curator fix
manuel-delvillar Feb 11, 2023
8b5e474
Correcting status check for Collection in CSV donwload endpoint
jchavez137 Feb 13, 2023
d70b8de
Correcting workspace type check for Collections
jchavez137 Feb 13, 2023
5244dc5
Update rqueue-spring-boot-starter to 2.13.0-RELEASE (#305)
JohnKallies Feb 10, 2023
a4c20cc
Adding unit test for findByOwner null case
jchavez137 Feb 14, 2023
d8d445e
Show workspace instead of collection
manuel-delvillar Feb 14, 2023
0d6afdc
Setting okta claims names to be retrieved from properties file
jchavez137 Feb 14, 2023
f7d5895
Correct out-of-date roles info in README (#310)
JohnKallies Feb 14, 2023
e79841a
Merge remote-tracking branch 'origin/develop' into feature/OSMT-124-m…
jchavez137 Feb 14, 2023
4f64210
Update collection skills update
manuel-delvillar Feb 14, 2023
0c68e28
Refactoring name for user identifier, correcting path to correctly se…
jchavez137 Feb 15, 2023
e9f86a5
Add all to my workspace
manuel-delvillar Feb 16, 2023
bc05408
Remove unused import
manuel-delvillar Feb 17, 2023
41c6ae2
Resolve pr conversations
manuel-delvillar Feb 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/src/main/kotlin/edu/wgu/osmt/RoutePaths.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ object RoutePaths {
const val COLLECTION_CSV = "$COLLECTION_DETAIL/csv"
const val COLLECTION_REMOVE = "$COLLECTION_DETAIL/remove"

const val WORKSPACE_PATH = "$API/workspace"

const val TASKS_PATH = "$API/results"
const val TASK_DETAIL_TEXT = "$TASKS_PATH/text/{uuid}"
Expand Down
8 changes: 6 additions & 2 deletions api/src/main/kotlin/edu/wgu/osmt/api/model/ApiCollection.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class ApiCollection(private val collection: Collection, private val ss: List<Ric
get() = collection.author?.let { it.value }

@get:JsonProperty
val status: PublishStatus
get() = collection.publishStatus()
val status: PublishStatus?
get() = collection.status

@get:JsonProperty
val creationDate: ZonedDateTime
Expand All @@ -63,6 +63,10 @@ class ApiCollection(private val collection: Collection, private val ss: List<Ric
val skills: List<ApiSkillSummary>
get() = ss.map { ApiSkillSummary.fromSkill(it, appConfig) }

@get:JsonProperty
val owner: String?
get() = collection.workspaceOwner

companion object {
fun fromDao(collectionDao: CollectionDao, appConfig: AppConfig): ApiCollection {
return ApiCollection(collectionDao.toModel(), collectionDao.skills.map{ it.toModel() }, appConfig)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package edu.wgu.osmt.api.model

import com.fasterxml.jackson.annotation.JsonFormat
import com.fasterxml.jackson.annotation.JsonProperty
import edu.wgu.osmt.db.PublishStatus

data class ApiCollectionUpdate(
@JsonProperty("name")
val name: String? = null,

@JsonFormat(with= [JsonFormat.Feature.ACCEPT_CASE_INSENSITIVE_PROPERTIES])
@JsonProperty("status")
val publishStatus: PublishStatus? = null,

Expand Down
2 changes: 1 addition & 1 deletion api/src/main/kotlin/edu/wgu/osmt/api/model/ApiSkill.kt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class ApiSkill(private val rsd: RichSkillDescriptor, private val cs: Set<Collect

companion object {
fun fromDao(rsdDao: RichSkillDescriptorDao, appConfig: AppConfig): ApiSkill{
return ApiSkill(rsdDao.toModel(), rsdDao.collections.map{ it.toModel() }.toSet(), appConfig)
return ApiSkill(rsdDao.toModel(), rsdDao.collections.map{ it.toModel() }.filter { !it.isWorkspace() }.toSet(), appConfig)
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions api/src/main/kotlin/edu/wgu/osmt/collection/Collection.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import edu.wgu.osmt.keyword.Keyword
import edu.wgu.osmt.keyword.KeywordDao
import edu.wgu.osmt.keyword.KeywordTypeEnum
import edu.wgu.osmt.richskill.RichSkillDescriptorDao
import org.apache.commons.lang3.StringUtils
import org.valiktor.functions.isEqualTo
import org.valiktor.functions.validate
import org.valiktor.validate
Expand All @@ -20,11 +21,17 @@ data class Collection(
val uuid: String,
val name: String,
val author: Keyword? = null,
val workspaceOwner: String? = null,
val status: PublishStatus,
override val archiveDate: LocalDateTime? = null,
override val publishDate: LocalDateTime? = null
) : DatabaseData, HasUpdateDate, PublishStatusDetails {

fun canonicalUrl(baseUrl: String): String = "$baseUrl/api/collections/${uuid}"

fun isWorkspace() : Boolean {
return (this.status == PublishStatus.Workspace && StringUtils.isNotEmpty(this.workspaceOwner))
}
}

data class CollectionUpdateObject(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import edu.wgu.osmt.api.model.ApiCollection
import edu.wgu.osmt.api.model.ApiCollectionUpdate
import edu.wgu.osmt.api.model.ApiSearch
import edu.wgu.osmt.api.model.ApiSkillListUpdate
import edu.wgu.osmt.api.model.ApiStringListUpdate
import edu.wgu.osmt.api.model.CollectionSortEnum
import edu.wgu.osmt.auditlog.AuditLog
import edu.wgu.osmt.auditlog.AuditLogRepository
import edu.wgu.osmt.auditlog.AuditLogSortEnum
import edu.wgu.osmt.config.AppConfig
import edu.wgu.osmt.config.DEFAULT_WORKSPACE_NAME
import edu.wgu.osmt.db.PublishStatus
import edu.wgu.osmt.elasticsearch.OffsetPageable
import edu.wgu.osmt.richskill.RichSkillRepository
Expand Down Expand Up @@ -97,7 +99,9 @@ class CollectionController @Autowired constructor(
): List<ApiCollection> {
return collectionRepository.createFromApi(
apiCollectionUpdates,
richSkillRepository, oAuthHelper.readableUsername(user)
richSkillRepository,
oAuthHelper.readableUserName(user),
oAuthHelper.readableUserIdentifier(user)
).map {
ApiCollection.fromDao(it, appConfig)
}
Expand All @@ -122,14 +126,13 @@ class CollectionController @Autowired constructor(
val updated = collectionRepository.updateFromApi(
existing.id.value,
apiUpdate,
richSkillRepository, oAuthHelper.readableUsername(user)
richSkillRepository, oAuthHelper.readableUserName(user)
)
?: throw ResponseStatusException(HttpStatus.NOT_FOUND)

return ApiCollection.fromDao(updated, appConfig)
}


@PostMapping(RoutePaths.COLLECTION_SKILLS_UPDATE, produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseBody
fun updateSkills(
Expand All @@ -142,7 +145,7 @@ class CollectionController @Autowired constructor(
@AuthenticationPrincipal user: Jwt?
): HttpEntity<TaskResult> {
val publishStatuses = status.mapNotNull { PublishStatus.forApiValue(it) }.toSet()
val task = UpdateCollectionSkillsTask(uuid, skillListUpdate, publishStatuses=publishStatuses, userString = oAuthHelper.readableUsername(user))
val task = UpdateCollectionSkillsTask(uuid, skillListUpdate, publishStatuses=publishStatuses, userString = oAuthHelper.readableUserName(user))

taskMessageService.enqueueJob(TaskMessageService.updateCollectionSkills, task)
return Task.processingResponse(task)
Expand All @@ -164,7 +167,7 @@ class CollectionController @Autowired constructor(
): HttpEntity<TaskResult> {
val filterStatuses = filterByStatus.mapNotNull { PublishStatus.forApiValue(it) }.toSet()
val publishStatus = PublishStatus.forApiValue(newStatus) ?: throw ResponseStatusException(HttpStatus.BAD_REQUEST)
val task = PublishTask(AppliesToType.Collection, search, filterByStatus=filterStatuses, publishStatus = publishStatus, userString = oAuthHelper.readableUsername(user))
val task = PublishTask(AppliesToType.Collection, search, filterByStatus=filterStatuses, publishStatus = publishStatus, userString = oAuthHelper.readableUserName(user))

taskMessageService.enqueueJob(TaskMessageService.publishSkills, task)
return Task.processingResponse(task)
Expand All @@ -174,7 +177,7 @@ class CollectionController @Autowired constructor(
fun getSkillsForCollectionCsv(
@PathVariable uuid: String
): HttpEntity<TaskResult> {
if (collectionRepository.findByUUID(uuid)!!.publishStatus() == PublishStatus.Draft && !oAuthHelper.hasRole(appConfig.roleAdmin)) {
if (collectionRepository.findByUUID(uuid)!!.status == PublishStatus.Draft && !oAuthHelper.hasRole(appConfig.roleAdmin)) {
throw ResponseStatusException(HttpStatus.UNAUTHORIZED)
}
val task = CsvTask(collectionUuid = uuid)
Expand All @@ -186,7 +189,6 @@ class CollectionController @Autowired constructor(
fun removeCollection(
@PathVariable uuid: String
): HttpEntity<TaskResult> {

val task = RemoveCollectionSkillsTask(collectionUuid = uuid)
taskMessageService.enqueueJob(TaskMessageService.removeCollectionSkills, task)
return Task.processingResponse(task)
Expand All @@ -203,4 +205,28 @@ class CollectionController @Autowired constructor(
val sizedIterable = auditLogRepository.findByTableAndId(CollectionTable.tableName, entityId = collection!!.id.value, offsetPageable = pageable)
return ResponseEntity.status(200).body(sizedIterable.toList().map{it.toModel()})
}

@GetMapping(RoutePaths.WORKSPACE_PATH, produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseBody
fun getOrCreateWorkspace(
@AuthenticationPrincipal user: Jwt?
): ApiCollection? {
return collectionRepository.findByOwner(
oAuthHelper.readableUserIdentifier(user))?.let {
ApiCollection.fromDao(it, appConfig
)
} ?: collectionRepository.createFromApi(
listOf(
ApiCollectionUpdate(
DEFAULT_WORKSPACE_NAME,
PublishStatus.Workspace,
oAuthHelper.readableUserName(user),
ApiStringListUpdate()
)
),
richSkillRepository,
oAuthHelper.readableUserName(user),
oAuthHelper.readableUserIdentifier(user)
).firstOrNull()?.let { ApiCollection.fromDao(it, appConfig) }
}
}
7 changes: 6 additions & 1 deletion api/src/main/kotlin/edu/wgu/osmt/collection/CollectionDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class CollectionDao(id: EntityID<Long>) : LongEntity(id), OutputsModel<Collectio
var uuid: String by CollectionTable.uuid
var name: String by CollectionTable.name
var author by KeywordDao optionalReferencedOn CollectionTable.author
var workspaceOwner by CollectionTable.workspaceOwner
var status by CollectionTable.status

var skills by RichSkillDescriptorDao via CollectionSkills

Expand All @@ -31,6 +33,8 @@ class CollectionDao(id: EntityID<Long>) : LongEntity(id), OutputsModel<Collectio
uuid = uuid,
name = name,
author = author?.toModel(),
workspaceOwner = workspaceOwner,
status = status,
archiveDate = archiveDate,
publishDate = publishDate
)
Expand All @@ -41,7 +45,8 @@ class CollectionDao(id: EntityID<Long>) : LongEntity(id), OutputsModel<Collectio
id = id.value,
uuid = uuid,
name = name,
publishStatus = publishStatus(),
workspaceOwner = workspaceOwner,
publishStatus = status,
skillIds = if (embedded) null else skills.map { it.uuid },
skillCount = if (embedded) null else skills.count().toInt(),
author = author?.value,
Expand Down
7 changes: 6 additions & 1 deletion api/src/main/kotlin/edu/wgu/osmt/collection/CollectionDoc.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,10 @@ data class CollectionDoc(

@Field(type = FieldType.Date, format = [DateFormat.date_hour_minute_second])
@get:JsonProperty("publishDate")
val publishDate: LocalDateTime? = null
val publishDate: LocalDateTime? = null,

@Field(type = Text)
@Nullable
val workspaceOwner: String?

)
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import edu.wgu.osmt.auditlog.AuditOperationType
import edu.wgu.osmt.config.AppConfig
import edu.wgu.osmt.db.ListFieldUpdate
import edu.wgu.osmt.db.NullableFieldUpdate
import edu.wgu.osmt.db.PublishStatus
import edu.wgu.osmt.keyword.KeywordRepository
import edu.wgu.osmt.keyword.KeywordTypeEnum
import edu.wgu.osmt.richskill.RichSkillDescriptor
Expand Down Expand Up @@ -43,15 +44,17 @@ interface CollectionRepository {
fun findById(id: Long): CollectionDao?
fun findByUUID(uuid: String): CollectionDao?
fun findByName(name: String): CollectionDao?
fun create(name: String, user: String): CollectionDao?
fun create(updateObject: CollectionUpdateObject, user: String): CollectionDao?
fun create(name: String, user: String, email: String): CollectionDao?
fun create(updateObject: CollectionUpdateObject, user: String, email: String): CollectionDao?
fun update(updateObject: CollectionUpdateObject, user: String): CollectionDao?
fun remove(uuid: String): ApiBatchResult
fun findByOwner(owner: String) : CollectionDao?

fun createFromApi(
apiUpdates: List<ApiCollectionUpdate>,
richSkillRepository: RichSkillRepository,
user: String
user: String,
email: String,
): List<CollectionDao>

fun collectionUpdateObjectFromApi(
Expand Down Expand Up @@ -107,11 +110,11 @@ class CollectionRepositoryImpl @Autowired constructor(
return query?.let { dao.wrapRow(it) }
}

override fun create(name: String, user: String): CollectionDao? {
return create(CollectionUpdateObject(name = name), user)
override fun create(name: String, user: String, email: String): CollectionDao? {
return create(CollectionUpdateObject(name = name), user, email)
}

override fun create(updateObject: CollectionUpdateObject, user: String): CollectionDao? {
override fun create(updateObject: CollectionUpdateObject, user: String, email: String): CollectionDao? {
if (updateObject.name.isNullOrBlank()) {
return null
}
Expand All @@ -125,6 +128,9 @@ class CollectionRepositoryImpl @Autowired constructor(
}

updateObject.copy(id = newCollection.id.value).applyToDao(newCollection)
if(PublishStatus.Workspace == newCollection.status) {
newCollection.workspaceOwner = email
}

newCollection.let {
collectionEsRepo.save(it.toDoc())
Expand Down Expand Up @@ -235,10 +241,16 @@ class CollectionRepositoryImpl @Autowired constructor(

}

override fun findByOwner(owner: String): CollectionDao? {
val query = table.select { table.workspaceOwner eq owner }.firstOrNull()
return query?.let { dao.wrapRow(it) }
}

override fun createFromApi(
apiUpdates: List<ApiCollectionUpdate>,
richSkillRepository: RichSkillRepository,
user: String
user: String,
email: String
): List<CollectionDao> {
// pre validate all rows
val allErrors = apiUpdates.mapIndexed { i, updateDto ->
Expand All @@ -251,7 +263,7 @@ class CollectionRepositoryImpl @Autowired constructor(
// create records
val newSkills = apiUpdates.map { update ->
val updateObject = collectionUpdateObjectFromApi(update, richSkillRepository)
create(updateObject, user)
create(updateObject, user, email)
}
return newSkills.filterNotNull()
}
Expand All @@ -270,7 +282,8 @@ class CollectionRepositoryImpl @Autowired constructor(
val collectionUpdateObject = collectionUpdateObjectFromApi(collectionUpdate, richSkillRepository)

val updateObjectWithId = collectionUpdateObject.copy(
id = existingCollectionId
id = existingCollectionId,
publishStatus = collectionUpdate.publishStatus
)

return update(updateObjectWithId, user)
Expand Down
14 changes: 11 additions & 3 deletions api/src/main/kotlin/edu/wgu/osmt/collection/CollectionTable.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package edu.wgu.osmt.collection

import edu.wgu.osmt.db.PublishStatus
import edu.wgu.osmt.db.PublishStatusUpdate
import edu.wgu.osmt.db.TableWithUpdate
import edu.wgu.osmt.keyword.KeywordTable
import edu.wgu.osmt.richskill.RichSkillDescriptorTable
import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.dao.id.LongIdTable
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.Column
import org.jetbrains.exposed.sql.ReferenceOption
import org.jetbrains.exposed.sql.Table
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.sql.insertIgnore
import org.jetbrains.exposed.sql.`java-time`.datetime
import java.time.LocalDateTime

Expand All @@ -23,8 +29,10 @@ object CollectionTable: TableWithUpdate<CollectionUpdateObject>, PublishStatusUp
onDelete = ReferenceOption.RESTRICT,
onUpdate = ReferenceOption.CASCADE
).nullable()


val workspaceOwner = varchar("workspace_owner", 64).index().default("")
val status = customEnumeration(
"status",
fromDb = { value -> PublishStatus.forApiValue(value as String)!! }, toDb = { it.name }).default(PublishStatus.Draft)
}

object CollectionSkills : Table("CollectionSkills") {
Expand Down
6 changes: 6 additions & 0 deletions api/src/main/kotlin/edu/wgu/osmt/config/AppConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ class AppConfig(
@Value("\${app.loginSuccessRedirectUrl}")
val loginSuccessRedirectUrl: String,

@Value("\${app.userName:name}")
val userName: String,

@Value("\${app.userIdentifier:email}")
val userIdentifier: String,

@Value("\${app.allowPublicSearching}")
val allowPublicSearching: Boolean = true,

Expand Down
1 change: 1 addition & 0 deletions api/src/main/kotlin/edu/wgu/osmt/config/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package edu.wgu.osmt.config

const val UNAUTHENTICATED_USERNAME = "unauthenticated"
const val QUOTED_SEARCH_REGEX_PATTERN = "([\"\'])(?:(?=(\\\\?))\\2.)*?\\1"
const val DEFAULT_WORKSPACE_NAME = "My Workspace"

// API parameter constants
const val CATEGORY_ASC = "name.asc"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class BatchImportRichSkill: CsvImport<RichSkillRow> {
fun parseCollections(rowValue: String?): List<CollectionDao>? {
return splitField(rowValue)?.filter { it.isNotBlank() }?.mapNotNull { collectionName ->
val collection = collectionRepository.findByName(collectionName)
collection ?: collectionRepository.create(CollectionUpdateObject(name = collectionName, author = NullableFieldUpdate(keywordRepository.getDefaultAuthor())), user)
collection ?: collection?.let { collectionRepository.create(CollectionUpdateObject(name = collectionName, author = NullableFieldUpdate(keywordRepository.getDefaultAuthor())), user, email = it.workspaceOwner) }
}
}

Expand Down
Loading