feat: update customer and service schemas to enforce maxLength and required attributes

- Added maxLength constraints to 'name' and 'phone' attributes in customer and service schemas.
- Marked 'name' as required in both schemas.
- Updated TypeScript definitions to reflect these changes.
This commit is contained in:
vchikalkin 2025-08-02 11:15:21 +03:00
parent 3833a1a23d
commit 50f23f67b3
3 changed files with 25 additions and 10 deletions

View File

@ -14,6 +14,7 @@
"attributes": {
"name": {
"type": "string",
"maxLength": 100,
"required": true
},
"telegramId": {
@ -22,21 +23,22 @@
},
"phone": {
"type": "string",
"unique": true,
"required": true
"maxLength": 20,
"required": true,
"unique": true
},
"role": {
"type": "enumeration",
"required": true,
"enum": [
"client",
"master"
],
"required": true
]
},
"active": {
"type": "boolean",
"default": false,
"required": false
"required": false,
"default": false
},
"clients": {
"type": "relation",

View File

@ -13,7 +13,9 @@
"pluginOptions": {},
"attributes": {
"name": {
"type": "string"
"type": "string",
"maxLength": 100,
"required": true
},
"orders": {
"type": "relation",

View File

@ -435,11 +435,18 @@ export interface ApiCustomerCustomer extends Struct.CollectionTypeSchema {
> &
Schema.Attribute.Private;
masters: Schema.Attribute.Relation<'manyToMany', 'api::customer.customer'>;
name: Schema.Attribute.String & Schema.Attribute.Required;
name: Schema.Attribute.String &
Schema.Attribute.Required &
Schema.Attribute.SetMinMaxLength<{
maxLength: 100;
}>;
orders: Schema.Attribute.Relation<'oneToMany', 'api::order.order'>;
phone: Schema.Attribute.String &
Schema.Attribute.Required &
Schema.Attribute.Unique;
Schema.Attribute.Unique &
Schema.Attribute.SetMinMaxLength<{
maxLength: 20;
}>;
photoUrl: Schema.Attribute.String;
publishedAt: Schema.Attribute.DateTime;
role: Schema.Attribute.Enumeration<['client', 'master']> &
@ -522,7 +529,11 @@ export interface ApiServiceService extends Struct.CollectionTypeSchema {
> &
Schema.Attribute.Private;
master: Schema.Attribute.Relation<'manyToOne', 'api::customer.customer'>;
name: Schema.Attribute.String;
name: Schema.Attribute.String &
Schema.Attribute.Required &
Schema.Attribute.SetMinMaxLength<{
maxLength: 100;
}>;
orders: Schema.Attribute.Relation<'manyToMany', 'api::order.order'>;
publishedAt: Schema.Attribute.DateTime;
updatedAt: Schema.Attribute.DateTime;