Skip to content

Commit

Permalink
Merge branch 'improvement/stricter-serp-api-enrichment-filter' of git…
Browse files Browse the repository at this point in the history
…hub.com:CrowdDotDev/crowd.dev into improvement/stricter-serp-api-enrichment-filter
  • Loading branch information
epipav committed Nov 4, 2024
2 parents 66f54f0 + 9d44c1c commit aa80955
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 18 deletions.
18 changes: 9 additions & 9 deletions backend/src/services/organizationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1013,19 +1013,19 @@ export default class OrganizationService extends LoggerBase {
}

async findAllAutocomplete(data) {
const segmentId = data.segments && data.segments.length > 0 ? data.segments[0] : undefined

const res = await OrganizationRepository.findAndCountAll(
const { filter, orderBy, limit, offset, segments } = data
return OrganizationRepository.findAndCountAll(
{
...data,
segmentId,
include: {
segments: true,
},
filter,
orderBy,
limit,
offset,
segmentId: segments.length > 0 ? segments[0] : undefined,
fields: ['id', 'segmentId', 'displayName', 'memberCount', 'activityCount', 'logo'],
include: { aggregates: true, identities: false, lfxMemberships: true },
},
this.options,
)
return res
}

async findAndCountAll(args) {
Expand Down
18 changes: 12 additions & 6 deletions frontend/src/modules/member/member-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,19 @@ export class MemberService {
segments,
}) {
const payload = {
filter: query ? {
displayName: {
textContains: query,
},
} : {},
filter: {
and: [
{ isBot: { not: true } },
{ isOrganization: { not: true } },
...(query ? [{
displayName: {
textContains: query,
},
}] : []),
],
},
offset: 0,
orderBy: 'displayName_ASC',
orderBy: 'activityCount_DESC',
limit,
...(segments && {
segments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,17 @@ import LfAvatar from '@/ui-kit/avatar/Avatar.vue';
import LfIconOld from '@/ui-kit/icon/IconOld.vue';
import LfProjectGroupsTags from '@/shared/modules/project-groups/components/project-groups-tags.vue';
import AppAutocompleteOneInput from '@/shared/form/autocomplete-one-input.vue';
import { storeToRefs } from 'pinia';
import { useLfSegmentsStore } from '@/modules/lf/segments/store';
const props = defineProps<{
modelValue: Organization | null,
}>();
const emit = defineEmits<{(e: 'update:modelValue', value: Organization | null): any}>();
const { selectedProjectGroup } = storeToRefs(useLfSegmentsStore());
const form = computed<Organization | null>({
get() {
return props.modelValue;
Expand All @@ -81,8 +85,8 @@ const fetchOrganizations = async ({ query } : {
query,
limit: 40,
excludeSegments: true,
})
.then((options: Organization[]) => options.filter((m) => m.id !== form.value?.id));
segments: [selectedProjectGroup.value?.id],
});
const createOrganization = (value: string) => OrganizationService.create({
name: value,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/modules/organization/organization-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export class OrganizationService {
],
},
offset: 0,
orderBy: 'displayName_ASC',
orderBy: 'activityCount_DESC',
limit,
...(segments && {
segments,
Expand Down

0 comments on commit aa80955

Please sign in to comment.