Skip to content

Commit

Permalink
Revert "Added Trade Name to Organizations Listing Page (#153)" (#162)
Browse files Browse the repository at this point in the history
This reverts commit c342fd9.
  • Loading branch information
enzomerca authored Jun 4, 2024
1 parent 5ff114e commit 49739c1
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 125 deletions.
11 changes: 6 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed
- Removed 0.50.0 version changes which contained a bug

## [0.50.0] - 2024-06-03

### Added
Expand Down Expand Up @@ -75,21 +78,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [0.48.2] - 2024-02-21

### Fixed

- Add analytics client to properly send metrics to redshift

## [0.48.1] - 2024-02-07

### Fixed

- Add retries to `sendMetric` to avoid connection errors

## [0.48.0] - 2024-01-19

### Added

- Allow `paymentTerms`, `collections` and `sellers` to be provided by name only on `createOrganizationAndCostCenterWithAdminUser`

## [0.47.1] - 2023-12-18

### Fixed
Expand Down Expand Up @@ -176,6 +176,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [0.37.0] - 2023-09-19


### Added

- Added event trigger on delete a user
Expand All @@ -191,8 +192,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added

- Added metrics for impersonate user
-

-
## [0.35.3] - 2023-08-09

### Fixed
Expand All @@ -211,6 +211,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Fix auth problem when fetching orders history


## [0.35.0] - 2023-07-24

### Added
Expand Down
3 changes: 0 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
{
"name": "colossus-fire-event"
},
{
"name": "colossus-listen-event"
},
{
"name": "update-app-settings"
},
Expand Down
15 changes: 0 additions & 15 deletions node/events/appAllEvents.ts

This file was deleted.

23 changes: 0 additions & 23 deletions node/events/appDependenciesUpdatedEvent.ts

This file was deleted.

22 changes: 0 additions & 22 deletions node/events/kubeRouterAuditEvent.ts

This file was deleted.

8 changes: 0 additions & 8 deletions node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import { LRUCache, Service } from '@vtex/api'
import { Clients } from './clients'
import { resolvers } from './resolvers'
import { schemaDirectives } from './resolvers/directives'
import { appDependenciesUpdatedEvent } from './events/appDependenciesUpdatedEvent'
import { kubeRouterAuditEvent } from './events/kubeRouterAuditEvent'
import { appAllEvents } from './events/appAllEvents'

const TIMEOUT_MS = 4000

Expand Down Expand Up @@ -54,9 +51,4 @@ export default new Service<Clients, RecorderState, ParamsContext>({
schemaDirectives,
},
routes: resolvers.Routes,
events: {
appDependenciesUpdatedEvent,
kubeRouterAuditEvent,
appAllEvents,
},
})
15 changes: 4 additions & 11 deletions node/mdSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const ORGANIZATION_REQUEST_FIELDS = [
'sellers',
'customFields',
]
export const ORGANIZATION_REQUEST_SCHEMA_VERSION = 'v0.1.2'
export const ORGANIZATION_REQUEST_SCHEMA_VERSION = 'v0.1.1'

export const ORGANIZATION_DATA_ENTITY = 'organizations'
export const ORGANIZATION_FIELDS = [
Expand All @@ -32,7 +32,7 @@ export const ORGANIZATION_FIELDS = [
'created',
'customFields',
]
export const ORGANIZATION_SCHEMA_VERSION = 'v0.0.9'
export const ORGANIZATION_SCHEMA_VERSION = 'v0.0.8'

export const COST_CENTER_DATA_ENTITY = 'cost_centers'
export const COST_CENTER_FIELDS = [
Expand Down Expand Up @@ -111,14 +111,7 @@ export const schemas = [
title: 'Custom Fields',
},
},
'v-indexed': [
'id',
'name',
'tradeName',
'b2bCustomerAdmin',
'status',
'created',
],
'v-indexed': ['name', 'b2bCustomerAdmin', 'status', 'created'],
'v-immediate-indexing': true,
'v-cache': false,
},
Expand Down Expand Up @@ -174,7 +167,7 @@ export const schemas = [
title: 'Custom Fields',
},
},
'v-indexed': ['id', 'name', 'tradeName', 'status', 'created'],
'v-indexed': ['name', 'status', 'created'],
'v-immediate-indexing': true,
'v-cache': false,
},
Expand Down
10 changes: 3 additions & 7 deletions node/resolvers/Queries/Organizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const getWhereByStatus = ({ status }: { status: string[] }) => {
if (status?.length) {
const statusArray = [] as string[]

status.forEach((stat: string) => {
status.forEach((stat) => {
statusArray.push(`status=${stat}`)
})
const statuses = `(${statusArray.join(' OR ')})`
Expand Down Expand Up @@ -132,9 +132,7 @@ const Organizations = {
const whereArray = getWhereByStatus({ status })

if (search) {
whereArray.push(
`(name="*${search}*" OR tradeName="*${search}*" OR id="*${search}*")`
)
whereArray.push(`name="*${search}*"`)
}

const where = whereArray.join(' AND ')
Expand Down Expand Up @@ -358,9 +356,7 @@ const Organizations = {
if (search.match(/[a-z\d]+@[a-z]+\.[a-z]{2,3}/gm)) {
whereArray.push(`b2bCustomerAdmin.email=${search}`)
} else {
whereArray.push(
`(name="*${search}*" OR tradeName="*${search}*" OR id="*${search}*")`
)
whereArray.push(`name="*${search}*"`)
}
}

Expand Down
15 changes: 6 additions & 9 deletions node/resolvers/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import type { EventContext } from '@vtex/api'

import type { Clients } from '../clients'
import { schemas } from '../mdSchema'
import templates from '../templates'
import { toHash } from '../utils'
Expand All @@ -22,7 +19,7 @@ export const getAppId = (): string => {
return appName
}

const checkConfig = async (ctx: Context | EventContext<Clients>) => {
const checkConfig = async (ctx: Context) => {
const {
vtex: { logger },
clients: { mail, masterdata, vbase },
Expand All @@ -47,7 +44,7 @@ const checkConfig = async (ctx: Context | EventContext<Clients>) => {
message: 'checkConfig-updatingSchema',
})

schemas.forEach((schema: any) => {
schemas.forEach((schema) => {
updates.push(
masterdata
.createOrUpdateSchema({
Expand All @@ -71,8 +68,8 @@ const checkConfig = async (ctx: Context | EventContext<Clients>) => {
)
})
try {
await Promise.all(updates).then((results: any) => {
if (results.every((res: any) => res === true)) {
await Promise.all(updates).then((results) => {
if (results.every((res) => res === true)) {
settings.schemaHash = currSchemaHash
schemaChanged = true
}
Expand All @@ -94,7 +91,7 @@ const checkConfig = async (ctx: Context | EventContext<Clients>) => {

try {
await Promise.all(
templates.map(async (template: any) => {
templates.map(async (template) => {
const existingData = await mail.getTemplate(template.Name)

if (!existingData) {
Expand All @@ -116,7 +113,7 @@ const checkConfig = async (ctx: Context | EventContext<Clients>) => {
settings.templateHash = currTemplateHash
templatesChanged = true
})
.catch((error: any) => {
.catch((error) => {
logger.error({
error,
message: 'checkConfig-publishTemplateError',
Expand Down
21 changes: 0 additions & 21 deletions node/service.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,5 @@
}
]
}
},
"events": {
"appDependenciesUpdatedEvent": {
"sender": "apps",
"topics": ["depsUpdated"]
},
"appAllEvents": {
"sender": "apps",
"topics": [
"linked",
"settings",
"depsUpdated",
"appVersionsUpdated",
"deprecated",
"undeprecated"
]
},
"kubeRouterAuditEvent": {
"sender": "kube-router",
"topics": ["audit"]
}
}
}
2 changes: 1 addition & 1 deletion node/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3475,7 +3475,7 @@ stack-utils@^2.0.3:
dependencies:
escape-string-regexp "^2.0.0"

stats-lite@vtex/node-stats-lite#dist:
"stats-lite@github:vtex/node-stats-lite#dist":
version "2.2.0"
resolved "https://codeload.github.com/vtex/node-stats-lite/tar.gz/1b0d39cc41ef7aaecfd541191f877887a2044797"
dependencies:
Expand Down

0 comments on commit 49739c1

Please sign in to comment.