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

View File

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

View File

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