Skip to content

Commit

Permalink
fix: acs_user warning should be an error
Browse files Browse the repository at this point in the history
  • Loading branch information
seambot authored Sep 19, 2024
1 parent ae1b176 commit 643cc9d
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 200 deletions.
12 changes: 4 additions & 8 deletions src/lib/seam/connect/models/acs/acs-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,23 @@ const acs_users_salto_ks_subscription_limit_exceeded = common_acs_user_error

const acs_users_failed_to_create_on_acs_system = common_acs_user_error
.extend({
warning_code: z.literal('failed_to_create_on_acs_system'),
error_code: z.literal('failed_to_create_on_acs_system'),
})
.describe(
`Indicates that the user was not created on the ACS system. This is likely due to an internal unexpected error. Please contact Seam's support if you encounter this.`,
)

const acs_users_failed_to_update_on_acs_system = common_acs_user_error
.extend({
warning_code: z.literal('failed_to_update_on_acs_system'),
error_code: z.literal('failed_to_update_on_acs_system'),
})
.describe(
`Indicates that the user was not updated on the ACS system. This is likely due to an internal unexpected error. Please contact Seam's support if you encounter this.`,
)

const acs_users_failed_to_delete_on_acs_system = common_acs_user_error
.extend({
warning_code: z.literal('failed_to_delete_on_acs_system'),
error_code: z.literal('failed_to_delete_on_acs_system'),
})
.describe(
`Indicates that the user was not deleted on the ACS system. This is likely due to an internal unexpected error. Please contact Seam's support if you encounter this.`,
Expand Down Expand Up @@ -121,11 +121,7 @@ export const acs_users_warning_map = z.object({
})

export const acs_users_warnings = z
.union([
acs_users_being_deleted,
acs_users_failed_to_update_on_acs_system,
acs_users_salto_ks_user_not_subscribed,
])
.union([acs_users_being_deleted, acs_users_salto_ks_user_not_subscribed])
.describe('Warning associated with the `acs_user`.')

export type AcsUsersWarningMap = z.infer<typeof acs_users_warning_map>
Expand Down
167 changes: 45 additions & 122 deletions src/lib/seam/connect/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -801,17 +801,17 @@ export default {
format: 'date-time',
type: 'string',
},
error_code: {
enum: ['failed_to_create_on_acs_system'],
type: 'string',
},
message: {
description:
'Detailed description of the error. Provides insights into the issue and potentially how to rectify it.',
type: 'string',
},
warning_code: {
enum: ['failed_to_create_on_acs_system'],
type: 'string',
},
},
required: ['created_at', 'message', 'warning_code'],
required: ['created_at', 'message', 'error_code'],
type: 'object',
},
{
Expand All @@ -824,17 +824,17 @@ export default {
format: 'date-time',
type: 'string',
},
error_code: {
enum: ['failed_to_update_on_acs_system'],
type: 'string',
},
message: {
description:
'Detailed description of the error. Provides insights into the issue and potentially how to rectify it.',
type: 'string',
},
warning_code: {
enum: ['failed_to_update_on_acs_system'],
type: 'string',
},
},
required: ['created_at', 'message', 'warning_code'],
required: ['created_at', 'message', 'error_code'],
type: 'object',
},
{
Expand All @@ -847,17 +847,17 @@ export default {
format: 'date-time',
type: 'string',
},
error_code: {
enum: ['failed_to_delete_on_acs_system'],
type: 'string',
},
message: {
description:
'Detailed description of the error. Provides insights into the issue and potentially how to rectify it.',
type: 'string',
},
warning_code: {
enum: ['failed_to_delete_on_acs_system'],
type: 'string',
},
},
required: ['created_at', 'message', 'warning_code'],
required: ['created_at', 'message', 'error_code'],
type: 'object',
},
],
Expand Down Expand Up @@ -904,29 +904,6 @@ export default {
required: ['created_at', 'message', 'warning_code'],
type: 'object',
},
{
description:
"Indicates that the user was not updated on the ACS system. This is likely due to an internal unexpected error. Please contact Seam's support if you encounter this.",
properties: {
created_at: {
description:
'Date and time at which Seam created the error.',
format: 'date-time',
type: 'string',
},
message: {
description:
'Detailed description of the error. Provides insights into the issue and potentially how to rectify it.',
type: 'string',
},
warning_code: {
enum: ['failed_to_update_on_acs_system'],
type: 'string',
},
},
required: ['created_at', 'message', 'warning_code'],
type: 'object',
},
{
description:
'Indicates that the user is not subscribed on the Salto KS, so they cannot unlock doors or perform any actions. This occur when the their access schedule hasn’t started yet, or if their access schedule has ended, or if the site has reached its limit for active users (subscription slots), or if they have been manually unsubscribed.',
Expand Down Expand Up @@ -8093,20 +8070,20 @@ export default {
format: 'date-time',
type: 'string',
},
error_code: {
enum: ['failed_to_create_on_acs_system'],
type: 'string',
},
message: {
description:
'Detailed description of the error. Provides insights into the issue and potentially how to rectify it.',
type: 'string',
},
warning_code: {
enum: ['failed_to_create_on_acs_system'],
type: 'string',
},
},
required: [
'created_at',
'message',
'warning_code',
'error_code',
],
type: 'object',
},
Expand All @@ -8120,20 +8097,20 @@ export default {
format: 'date-time',
type: 'string',
},
error_code: {
enum: ['failed_to_update_on_acs_system'],
type: 'string',
},
message: {
description:
'Detailed description of the error. Provides insights into the issue and potentially how to rectify it.',
type: 'string',
},
warning_code: {
enum: ['failed_to_update_on_acs_system'],
type: 'string',
},
},
required: [
'created_at',
'message',
'warning_code',
'error_code',
],
type: 'object',
},
Expand All @@ -8147,20 +8124,20 @@ export default {
format: 'date-time',
type: 'string',
},
error_code: {
enum: ['failed_to_delete_on_acs_system'],
type: 'string',
},
message: {
description:
'Detailed description of the error. Provides insights into the issue and potentially how to rectify it.',
type: 'string',
},
warning_code: {
enum: ['failed_to_delete_on_acs_system'],
type: 'string',
},
},
required: [
'created_at',
'message',
'warning_code',
'error_code',
],
type: 'object',
},
Expand Down Expand Up @@ -8230,33 +8207,6 @@ export default {
],
type: 'object',
},
{
description:
"Indicates that the user was not updated on the ACS system. This is likely due to an internal unexpected error. Please contact Seam's support if you encounter this.",
properties: {
created_at: {
description:
'Date and time at which Seam created the error.',
format: 'date-time',
type: 'string',
},
message: {
description:
'Detailed description of the error. Provides insights into the issue and potentially how to rectify it.',
type: 'string',
},
warning_code: {
enum: ['failed_to_update_on_acs_system'],
type: 'string',
},
},
required: [
'created_at',
'message',
'warning_code',
],
type: 'object',
},
{
description:
'Indicates that the user is not subscribed on the Salto KS, so they cannot unlock doors or perform any actions. This occur when the their access schedule hasn’t started yet, or if their access schedule has ended, or if the site has reached its limit for active users (subscription slots), or if they have been manually unsubscribed.',
Expand Down Expand Up @@ -8434,20 +8384,20 @@ export default {
format: 'date-time',
type: 'string',
},
error_code: {
enum: ['failed_to_create_on_acs_system'],
type: 'string',
},
message: {
description:
'Detailed description of the error. Provides insights into the issue and potentially how to rectify it.',
type: 'string',
},
warning_code: {
enum: ['failed_to_create_on_acs_system'],
type: 'string',
},
},
required: [
'created_at',
'message',
'warning_code',
'error_code',
],
type: 'object',
},
Expand All @@ -8461,20 +8411,20 @@ export default {
format: 'date-time',
type: 'string',
},
error_code: {
enum: ['failed_to_update_on_acs_system'],
type: 'string',
},
message: {
description:
'Detailed description of the error. Provides insights into the issue and potentially how to rectify it.',
type: 'string',
},
warning_code: {
enum: ['failed_to_update_on_acs_system'],
type: 'string',
},
},
required: [
'created_at',
'message',
'warning_code',
'error_code',
],
type: 'object',
},
Expand All @@ -8488,20 +8438,20 @@ export default {
format: 'date-time',
type: 'string',
},
error_code: {
enum: ['failed_to_delete_on_acs_system'],
type: 'string',
},
message: {
description:
'Detailed description of the error. Provides insights into the issue and potentially how to rectify it.',
type: 'string',
},
warning_code: {
enum: ['failed_to_delete_on_acs_system'],
type: 'string',
},
},
required: [
'created_at',
'message',
'warning_code',
'error_code',
],
type: 'object',
},
Expand Down Expand Up @@ -8571,33 +8521,6 @@ export default {
],
type: 'object',
},
{
description:
"Indicates that the user was not updated on the ACS system. This is likely due to an internal unexpected error. Please contact Seam's support if you encounter this.",
properties: {
created_at: {
description:
'Date and time at which Seam created the error.',
format: 'date-time',
type: 'string',
},
message: {
description:
'Detailed description of the error. Provides insights into the issue and potentially how to rectify it.',
type: 'string',
},
warning_code: {
enum: ['failed_to_update_on_acs_system'],
type: 'string',
},
},
required: [
'created_at',
'message',
'warning_code',
],
type: 'object',
},
{
description:
'Indicates that the user is not subscribed on the Salto KS, so they cannot unlock doors or perform any actions. This occur when the their access schedule hasn’t started yet, or if their access schedule has ended, or if the site has reached its limit for active users (subscription slots), or if they have been manually unsubscribed.',
Expand Down
Loading

0 comments on commit 643cc9d

Please sign in to comment.