Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
155 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
18b9a96
Add new components
manuel-delvillar 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
8703609
Add drop down
manuel-delvillar Feb 13, 2023
ea1e061
Add filter menu
manuel-delvillar Feb 14, 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
1eab560
Add expand panel
manuel-delvillar Feb 14, 2023
c41e5c2
Add filter chips
manuel-delvillar Feb 14, 2023
4f64210
Update collection skills update
manuel-delvillar Feb 14, 2023
de7770f
Working on chips
manuel-delvillar Feb 14, 2023
661e298
Remove extends
manuel-delvillar Feb 15, 2023
aee37f9
Bind chips and filter dropdown
manuel-delvillar Feb 15, 2023
7a78074
Remove form module
manuel-delvillar Feb 15, 2023
dda05a6
Add flex to filter chips
manuel-delvillar Feb 15, 2023
83beb00
Improve search and dropdown
manuel-delvillar Feb 15, 2023
0c68e28
Refactoring name for user identifier, correcting path to correctly se…
jchavez137 Feb 15, 2023
887244d
Add tests
manuel-delvillar Feb 15, 2023
252bee0
Add selected values
manuel-delvillar Feb 16, 2023
67282a3
Bind chips and multi select.
manuel-delvillar Feb 16, 2023
e9f86a5
Add all to my workspace
manuel-delvillar Feb 16, 2023
bc05408
Remove unused import
manuel-delvillar Feb 17, 2023
e8d328a
first Attempt to build Filtered query
jchavez137 Feb 17, 2023
d6bab2b
Merge branch 'feature/OSMT-12-search-filters' into feature/OSMT-12-ad…
manuel-delvillar Feb 17, 2023
4cc1f9f
Fix remove comma
manuel-delvillar Feb 17, 2023
b0a18b5
Add alignment
manuel-delvillar Feb 17, 2023
1947b0f
Fix remove chip
manuel-delvillar Feb 20, 2023
20affee
Restore values
manuel-delvillar Feb 20, 2023
63cd7cc
Refactor variable name
manuel-delvillar Feb 20, 2023
c1a5c63
Reload on change drop down filter
manuel-delvillar Feb 20, 2023
2c6ee11
Refactor form group
manuel-delvillar Feb 20, 2023
5d89171
Add alignment chips
manuel-delvillar Feb 20, 2023
a07f64d
Remove unused code
manuel-delvillar Feb 20, 2023
b93456f
Add remove event
manuel-delvillar Feb 20, 2023
b1d5fef
trying nested queries
jchavez137 Feb 21, 2023
a532373
Merge remote-tracking branch 'origin/develop' into feature/OSMT-12-ad…
jchavez137 Feb 21, 2023
7d80751
correcting import
jchavez137 Feb 21, 2023
540ec34
Fix merge
manuel-delvillar Feb 21, 2023
c050fce
Update tests
manuel-delvillar Feb 21, 2023
a9839f8
Fix tests
manuel-delvillar Feb 21, 2023
d0b0c0b
trying nested queries attempt #2 using disjuctionQuery
jchavez137 Feb 22, 2023
9e6c393
Implementing nested query with categories
jchavez137 Feb 22, 2023
648c417
Add author & ApiAdvancedFilteredSearch
manuel-delvillar Feb 23, 2023
900e175
Clean code
manuel-delvillar Feb 23, 2023
077bcf3
Implementing queries in ESrepo layer for keywords, standards, aligmen…
jchavez137 Feb 23, 2023
653b138
Adding JobCodes to nested query
jchavez137 Feb 24, 2023
59ccbf4
Adding draft Endpoint to use post in skills filtered
jchavez137 Feb 24, 2023
18139c5
Refactoring Request Body Object
jchavez137 Feb 24, 2023
931f4b8
Reverting ApiFilteredSearch naming back for it to be deserialized pro…
jchavez137 Feb 24, 2023
51c935a
Add ApiAdvancedFilteredSearch in request
manuel-delvillar Feb 23, 2023
191dd70
Short imports
manuel-delvillar Feb 23, 2023
0635d85
Add request to ApiAdvancedFilteredSearch
manuel-delvillar Feb 24, 2023
0334b36
Update tests
manuel-delvillar Feb 24, 2023
f3b5aa7
Working on open api
manuel-delvillar Feb 24, 2023
2a994a1
ApiJobCode or ApiNamedReference instead of string.
manuel-delvillar Feb 24, 2023
ad628ad
Update tests
manuel-delvillar Feb 24, 2023
a245cfe
Add tests
manuel-delvillar Feb 24, 2023
6ceb43b
Adding unit tests for categories and searching keywords filters
jchavez137 Feb 27, 2023
03bbde6
Show or hide new filters
manuel-delvillar Feb 27, 2023
4d7408b
Adding unit tests for standards, certifications, alignments and emplo…
jchavez137 Feb 27, 2023
52c3875
Update open api doc
manuel-delvillar Feb 27, 2023
af9acc6
Adding unit tests for occupations filter only
jchavez137 Feb 27, 2023
c84c96b
Adding unit tests for mixed filters applied
jchavez137 Feb 28, 2023
97d97c9
Adding unit tests for more mixed filters applied
jchavez137 Feb 28, 2023
dd043d6
Merge branch 'develop' into feature/OSMT-12-add-filters-search
jchavez137 Feb 28, 2023
5690c51
Removing replaced endpoint
jchavez137 Feb 28, 2023
cc3d5ff
Adding logic to retrieve all keywords incidences of a particular type
jchavez137 Mar 1, 2023
6ab4ccb
Adding logic to retrieve all jobcodes incidences of a particular type
jchavez137 Mar 1, 2023
90ca039
Add close and decrease font size
manuel-delvillar Mar 1, 2023
52bba8c
Show all keywords before you write
manuel-delvillar Mar 1, 2023
0f5be2e
Remove test
manuel-delvillar Mar 1, 2023
c8c1a32
Updating unit test for typeahead repo logic
jchavez137 Mar 2, 2023
b04d9a4
Increasing limit for display keyword typeAhead results, rebuilding fi…
jchavez137 Mar 2, 2023
8eeff17
Refactoring filters logic to work along with query search
jchavez137 Mar 3, 2023
61cc7f4
Clear field only when input has text
manuel-delvillar Mar 2, 2023
e949f81
Fix remove value
manuel-delvillar Mar 2, 2023
5a9c0df
Improve chips
manuel-delvillar Mar 2, 2023
0aae474
Add advanced filtered search on rich-skills-search
manuel-delvillar Mar 3, 2023
557eaa0
Update tests
manuel-delvillar Mar 3, 2023
90dfb9b
Refactoring building ES Query to use Must instead of Should when filt…
jchavez137 Mar 3, 2023
3bea867
Adding filtered logic when working with collection UUID to switch to …
jchavez137 Mar 3, 2023
5110441
Correcting And Operator Logic scope
jchavez137 Mar 3, 2023
8efe28b
Add query with advanced filtered search
manuel-delvillar Mar 3, 2023
8e68165
Fix broken tests
manuel-delvillar Mar 3, 2023
ae2196d
Change chips distribution
manuel-delvillar Mar 3, 2023
c6184e9
Add min width to chip wrapper
manuel-delvillar Mar 6, 2023
bb72d31
Change result name jobcodes
manuel-delvillar Mar 6, 2023
5bdf5ef
Update filter search test
manuel-delvillar Mar 6, 2023
85a3bc1
Setting sort oder for Keyword and JobCode in TypeAhead to be retrieve…
jchavez137 Mar 6, 2023
9063e28
Update filter controls ng if
manuel-delvillar Mar 6, 2023
f053587
Reverting back Get skills endpoint and Documentation in OpenAPI, also…
jchavez137 Mar 7, 2023
61dbf20
Merge remote-tracking branch 'origin/develop' into feature/OSMT-12-ad…
JohnKallies Mar 8, 2023
97b7947
Remove unused parameter
manuel-delvillar Mar 8, 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 @@ -13,6 +13,7 @@ object RoutePaths {
const val SKILLS_PATH = "$API/skills"
const val SKILLS_LIST = SKILLS_PATH
const val SKILLS_CREATE = SKILLS_PATH
const val SKILLS_FILTER = "$SKILLS_PATH/filter"
const val SKILL_PUBLISH = "$SKILLS_PATH/publish"
const val SKILL_DETAIL = "$SKILLS_PATH/{uuid}"
const val SKILL_UPDATE = "$SKILL_DETAIL/update"
Expand Down
34 changes: 34 additions & 0 deletions api/src/main/kotlin/edu/wgu/osmt/api/model/ApiSearch.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ data class ApiSearch(
@JsonProperty("advanced")
val advanced: ApiAdvancedSearch? = null,

@JsonProperty("filtered")
val filtered: ApiFilteredSearch? = null,

@JsonProperty("uuids")
val uuids: List<String>? = null
)
Expand Down Expand Up @@ -58,3 +61,34 @@ data class ApiSkillListUpdate(
@JsonProperty("remove")
val remove: ApiSearch? = null
)

@JsonInclude(JsonInclude.Include.ALWAYS)
data class ApiFilteredSearch(

@JsonProperty("categories")
val categories: List<String>? = null,

@JsonProperty("keywords")
val keywords: List<String>? = null,

@JsonProperty("standards")
val standards: List<String>? = null,

@JsonProperty("certifications")
val certifications: List<String>? = null,

@JsonProperty("alignments")
val alignments: List<String>? = null,

@JsonProperty("jobcodes")
val jobCodes: List<String>? = null,

@JsonProperty("employers")
val employers: List<String>? = null,

@JsonProperty("authors")
val authors: List<String>? = null,

@JsonProperty("occupations")
val occupations: List<String>? = null
)
5 changes: 3 additions & 2 deletions api/src/main/kotlin/edu/wgu/osmt/config/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const val INDEX_JOBCODE_DOC = "jobcode_v1"
const val INDEX_KEYWORD_DOC = "keyword"

// ElasticSearch Sort Criteria
const val NAME_SORT_INSENSITIVE = "name.sort_insensitive"
const val CATEGORY_SORT_INSENSITIVE = "category.sort_insensitive"
const val SORT_INSENSITIVE = ".sort_insensitive"
const val NAME_SORT_INSENSITIVE = "name${SORT_INSENSITIVE}"
const val CATEGORY_SORT_INSENSITIVE = "category${SORT_INSENSITIVE}"

16 changes: 11 additions & 5 deletions api/src/main/kotlin/edu/wgu/osmt/jobcode/JobCodeEsRepo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.elasticsearch.index.query.BoolQueryBuilder
import org.elasticsearch.index.query.Operator
import org.elasticsearch.index.query.QueryBuilders.*
import org.elasticsearch.search.sort.SortBuilders
import org.elasticsearch.search.sort.SortOrder
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.annotation.Configuration
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate
Expand All @@ -28,13 +29,18 @@ class CustomJobCodeRepositoryImpl @Autowired constructor(override val elasticSea
CustomJobCodeRepository {

override fun typeAheadSearch(query: String): SearchHits<JobCode> {
val limitedPageable = OffsetPageable(0, 10, null)
val disjunctionQuery = JobCodeQueries.multiPropertySearch(query)
val nsq: NativeSearchQueryBuilder

val nsq: NativeSearchQueryBuilder =
NativeSearchQueryBuilder().withPageable(limitedPageable).withQuery(disjunctionQuery)
.withSort(SortBuilders.scoreSort())
val limitedPageable: OffsetPageable = if (query.isEmpty()) {
OffsetPageable(0, 10000, null)
} else {
OffsetPageable(0, 20, null)

}
val disjunctionQuery = JobCodeQueries.multiPropertySearch(query)
nsq =
NativeSearchQueryBuilder().withPageable(limitedPageable).withQuery(disjunctionQuery)
.withSort(SortBuilders.fieldSort("${JobCode::code.name}.keyword").order(SortOrder.ASC))
return elasticSearchTemplate.search(nsq.build(), JobCode::class.java)
}
}
Expand Down
17 changes: 14 additions & 3 deletions api/src/main/kotlin/edu/wgu/osmt/keyword/Keyword.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
package edu.wgu.osmt.keyword

import edu.wgu.osmt.config.INDEX_KEYWORD_DOC
import edu.wgu.osmt.db.*
import edu.wgu.osmt.db.DatabaseData
import edu.wgu.osmt.db.HasUpdateDate
import edu.wgu.osmt.db.NullableFieldUpdate
import edu.wgu.osmt.db.TableWithUpdate
import edu.wgu.osmt.db.UpdateObject
import org.elasticsearch.core.Nullable
import org.jetbrains.exposed.dao.id.LongIdTable
import org.jetbrains.exposed.sql.Column
import org.jetbrains.exposed.sql.`java-time`.datetime
import org.springframework.data.annotation.Id
import org.springframework.data.elasticsearch.annotations.*
import org.springframework.data.elasticsearch.annotations.DateFormat
import org.springframework.data.elasticsearch.annotations.Document
import org.springframework.data.elasticsearch.annotations.Field
import org.springframework.data.elasticsearch.annotations.FieldType
import org.springframework.data.elasticsearch.annotations.InnerField
import org.springframework.data.elasticsearch.annotations.MultiField
import org.springframework.data.elasticsearch.annotations.Setting
import java.time.LocalDateTime

@Document(indexName = INDEX_KEYWORD_DOC, createIndex = true)
Expand All @@ -32,7 +42,8 @@ data class Keyword(
otherFields = [
InnerField(suffix = "", type = FieldType.Search_As_You_Type),
InnerField(suffix = "raw", analyzer = "whitespace_exact", type = FieldType.Text),
InnerField(suffix = "keyword", type = FieldType.Keyword)
InnerField(suffix = "keyword", type = FieldType.Keyword),
InnerField(suffix = "sort_insensitive", type = FieldType.Keyword, normalizer = "lowercase_normalizer")
]
)
val value: String? = null,
Expand Down
49 changes: 32 additions & 17 deletions api/src/main/kotlin/edu/wgu/osmt/keyword/KeywordEsRepo.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package edu.wgu.osmt.keyword

import edu.wgu.osmt.config.INDEX_KEYWORD_DOC
import edu.wgu.osmt.config.SORT_INSENSITIVE
import edu.wgu.osmt.elasticsearch.OffsetPageable
import org.elasticsearch.index.query.QueryBuilders
import org.elasticsearch.search.sort.SortBuilders
import org.elasticsearch.search.sort.SortOrder
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.annotation.Configuration
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate
Expand All @@ -25,26 +27,39 @@ interface CustomKeywordRepository {
class CustomKeywordRepositoryImpl @Autowired constructor(override val elasticSearchTemplate: ElasticsearchRestTemplate) :
CustomKeywordRepository {
override fun typeAheadSearch(query: String, type: KeywordTypeEnum): SearchHits<Keyword> {
val limitedPageable = OffsetPageable(0, 10, null)
val limitedPageable: OffsetPageable
val bq = QueryBuilders.boolQuery()
val nsq: NativeSearchQueryBuilder

val nsq: NativeSearchQueryBuilder =
NativeSearchQueryBuilder().withPageable(limitedPageable).withQuery(bq).withSort(SortBuilders.scoreSort())

bq
.must(QueryBuilders.termQuery(Keyword::type.name, type.name))
.should(
QueryBuilders.matchBoolPrefixQuery(
Keyword::value.name,
query
if(query.isEmpty()){ //retrieve all
limitedPageable = OffsetPageable(0, 10000, null)
nsq = NativeSearchQueryBuilder().withPageable(limitedPageable).withQuery(bq)
.withSort(SortBuilders.fieldSort("${Keyword::value.name}$SORT_INSENSITIVE").order(SortOrder.ASC))
bq
.must(QueryBuilders.termQuery(Keyword::type.name, type.name))
.should(
QueryBuilders.matchAllQuery()
)
}
else {
limitedPageable = OffsetPageable(0, 20, null)
nsq = NativeSearchQueryBuilder().withPageable(limitedPageable).withQuery(bq)
.withSort(SortBuilders.fieldSort("${Keyword::value.name}$SORT_INSENSITIVE").order(SortOrder.ASC))
bq
.must(QueryBuilders.termQuery(Keyword::type.name, type.name))
.should(
QueryBuilders.matchBoolPrefixQuery(
Keyword::value.name,
query
)
)
)
.should(
QueryBuilders.matchPhraseQuery(
Keyword::value.name,
query
).boost(5f)
).minimumShouldMatch(1)
.should(
QueryBuilders.matchPhraseQuery(
Keyword::value.name,
query
).boost(5f)
).minimumShouldMatch(1)
}

return elasticSearchTemplate.search(nsq.build(), Keyword::class.java)
}
Expand Down
48 changes: 48 additions & 0 deletions api/src/main/kotlin/edu/wgu/osmt/richskill/RichSkillController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@ package edu.wgu.osmt.richskill

import edu.wgu.osmt.HasAllPaginated
import edu.wgu.osmt.RoutePaths
import edu.wgu.osmt.RoutePaths.SKILLS_FILTER
import edu.wgu.osmt.api.GeneralApiException
import edu.wgu.osmt.api.model.ApiSearch
import edu.wgu.osmt.api.model.ApiSkill
import edu.wgu.osmt.api.model.ApiSkillUpdate
import edu.wgu.osmt.api.model.SkillSortEnum
import edu.wgu.osmt.api.model.SortOrder
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.db.PublishStatus
import edu.wgu.osmt.elasticsearch.OffsetPageable
import edu.wgu.osmt.elasticsearch.PaginatedLinks
import edu.wgu.osmt.keyword.KeywordDao
import edu.wgu.osmt.security.OAuthHelper
import edu.wgu.osmt.task.AppliesToType
Expand All @@ -23,6 +26,7 @@ import edu.wgu.osmt.task.PublishTask
import edu.wgu.osmt.task.Task
import edu.wgu.osmt.task.TaskMessageService
import edu.wgu.osmt.task.TaskResult
import org.apache.commons.lang3.StringUtils
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.HttpEntity
import org.springframework.http.HttpHeaders
Expand Down Expand Up @@ -75,6 +79,50 @@ class RichSkillController @Autowired constructor(
}
return super.allPaginated(uriComponentsBuilder, size, from, status, sort, user)
}
@PostMapping(SKILLS_FILTER, produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseBody
fun allPaginatedWithFilters(
uriComponentsBuilder: UriComponentsBuilder,
size: Int,
from: Int,
status: Array<String>,
@RequestBody apiSearch: ApiSearch,
sort: String?,
@AuthenticationPrincipal user: Jwt?
): HttpEntity<List<RichSkillDoc>> {

val publishStatuses = status.mapNotNull {
val status = PublishStatus.forApiValue(it)
if (user == null && (status == PublishStatus.Deleted || status == PublishStatus.Draft)) null else status
}.toSet()
val sortEnum: SortOrder = sortOrderCompanion.forValueOrDefault(sort)
val pageable = OffsetPageable(from, size, sortEnum.sort)
val searchHits = richSkillEsRepo.byApiSearch(
apiSearch,
publishStatuses,
pageable,
StringUtils.EMPTY
)
val countAllFiltered: Long = searchHits.totalHits
val responseHeaders = HttpHeaders()
responseHeaders.add("X-Total-Count", countAllFiltered.toString())

uriComponentsBuilder
.path(SKILLS_FILTER)
.queryParam(RoutePaths.QueryParams.FROM, from)
.queryParam(RoutePaths.QueryParams.SIZE, size)
.queryParam(RoutePaths.QueryParams.SORT, sort)
.queryParam(RoutePaths.QueryParams.STATUS, status.joinToString(",").toLowerCase())

PaginatedLinks(
pageable,
searchHits.totalHits.toInt(),
uriComponentsBuilder
).addToHeaders(responseHeaders)

return ResponseEntity.status(200).headers(responseHeaders)
.body(searchHits.map { it.content }.toList())
}

@PostMapping(RoutePaths.SKILLS_CREATE, produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseBody
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/kotlin/edu/wgu/osmt/richskill/RichSkillDoc.kt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ data class RichSkillDoc(
InnerField(suffix = "keyword", type = Keyword)
]
)
@get:JsonIgnore
@get:JsonProperty("standards")
val standards: List<String> = listOf(),

@MultiField(
Expand Down
Loading