Skip to content

Commit b7f0294

Browse files
committed
feat: increase max notes char count to 2056
1 parent a9d25a2 commit b7f0294

File tree

4 files changed

+162
-4
lines changed

4 files changed

+162
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package migrations
2+
3+
import (
4+
"encoding/json"
5+
6+
"github.com/pocketbase/dbx"
7+
"github.com/pocketbase/pocketbase/daos"
8+
m "github.com/pocketbase/pocketbase/migrations"
9+
"github.com/pocketbase/pocketbase/models/schema"
10+
)
11+
12+
func init() {
13+
m.Register(func(db dbx.Builder) error {
14+
dao := daos.New(db);
15+
16+
collection, err := dao.FindCollectionByNameOrId("m2mup2n0m54y9eq")
17+
if err != nil {
18+
return err
19+
}
20+
21+
// update
22+
edit_notes := &schema.SchemaField{}
23+
if err := json.Unmarshal([]byte(`{
24+
"system": false,
25+
"id": "b4vi1qw6",
26+
"name": "notes",
27+
"type": "text",
28+
"required": false,
29+
"presentable": false,
30+
"unique": false,
31+
"options": {
32+
"min": null,
33+
"max": 2056,
34+
"pattern": ""
35+
}
36+
}`), edit_notes); err != nil {
37+
return err
38+
}
39+
collection.Schema.AddField(edit_notes)
40+
41+
return dao.SaveCollection(collection)
42+
}, func(db dbx.Builder) error {
43+
dao := daos.New(db);
44+
45+
collection, err := dao.FindCollectionByNameOrId("m2mup2n0m54y9eq")
46+
if err != nil {
47+
return err
48+
}
49+
50+
// update
51+
edit_notes := &schema.SchemaField{}
52+
if err := json.Unmarshal([]byte(`{
53+
"system": false,
54+
"id": "b4vi1qw6",
55+
"name": "notes",
56+
"type": "text",
57+
"required": false,
58+
"presentable": false,
59+
"unique": false,
60+
"options": {
61+
"min": null,
62+
"max": 512,
63+
"pattern": ""
64+
}
65+
}`), edit_notes); err != nil {
66+
return err
67+
}
68+
collection.Schema.AddField(edit_notes)
69+
70+
return dao.SaveCollection(collection)
71+
})
72+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package migrations
2+
3+
import (
4+
"encoding/json"
5+
6+
"github.com/pocketbase/dbx"
7+
"github.com/pocketbase/pocketbase/daos"
8+
m "github.com/pocketbase/pocketbase/migrations"
9+
"github.com/pocketbase/pocketbase/models/schema"
10+
)
11+
12+
func init() {
13+
m.Register(func(db dbx.Builder) error {
14+
dao := daos.New(db);
15+
16+
collection, err := dao.FindCollectionByNameOrId("qj1mfdg2t94z9ja")
17+
if err != nil {
18+
return err
19+
}
20+
21+
// update
22+
edit_notes := &schema.SchemaField{}
23+
if err := json.Unmarshal([]byte(`{
24+
"system": false,
25+
"id": "xbckrifz",
26+
"name": "notes",
27+
"type": "text",
28+
"required": false,
29+
"presentable": false,
30+
"unique": false,
31+
"options": {
32+
"min": null,
33+
"max": 2056,
34+
"pattern": ""
35+
}
36+
}`), edit_notes); err != nil {
37+
return err
38+
}
39+
collection.Schema.AddField(edit_notes)
40+
41+
return dao.SaveCollection(collection)
42+
}, func(db dbx.Builder) error {
43+
dao := daos.New(db);
44+
45+
collection, err := dao.FindCollectionByNameOrId("qj1mfdg2t94z9ja")
46+
if err != nil {
47+
return err
48+
}
49+
50+
// update
51+
edit_notes := &schema.SchemaField{}
52+
if err := json.Unmarshal([]byte(`{
53+
"system": false,
54+
"id": "xbckrifz",
55+
"name": "notes",
56+
"type": "text",
57+
"required": false,
58+
"presentable": false,
59+
"unique": false,
60+
"options": {
61+
"min": null,
62+
"max": 512,
63+
"pattern": ""
64+
}
65+
}`), edit_notes); err != nil {
66+
return err
67+
}
68+
collection.Schema.AddField(edit_notes)
69+
70+
return dao.SaveCollection(collection)
71+
})
72+
}

frontend/src/components/templates/EditAccountTemplate.vue

+9-2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ const hasDataChanged = computed(() => {
5353
);
5454
});
5555
56+
const MAX_NOTES_LENGTH = 2056 as const;
57+
5658
const rules = computed<FormValidation<UnwrapRef<typeof state>>>(() => ({
5759
name: [
5860
{ required: true, message: t("validations.required") },
@@ -62,7 +64,12 @@ const rules = computed<FormValidation<UnwrapRef<typeof state>>>(() => ({
6264
{ required: true, message: t("validations.required") },
6365
{ type: "number", message: t("validations.number") },
6466
],
65-
notes: [{ max: 512, message: t("validations.maxLength", { max: 512 }) }],
67+
notes: [
68+
{
69+
max: MAX_NOTES_LENGTH,
70+
message: t("validations.maxLength", { max: MAX_NOTES_LENGTH }),
71+
},
72+
],
6673
}));
6774
6875
const formRef = ref<FormInstance | null>(null);
@@ -143,7 +150,7 @@ const handleSubmit = async () => {
143150
name="notes"
144151
type="textarea"
145152
:autosize="{ minRows: 4, maxRows: 16 }"
146-
:maxlength="512"
153+
:maxlength="MAX_NOTES_LENGTH"
147154
show-word-limit
148155
/>
149156
</el-form-item>

frontend/src/components/templates/EditTransactionTemplate.vue

+9-2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ const hasDataChanged = computed(() => {
9494
);
9595
});
9696
97+
const MAX_NOTES_LENGTH = 2056 as const;
98+
9799
const rules = computed<FormValidation<UnwrapRef<typeof state>>>(() => ({
98100
name: [
99101
{ required: true, message: t("validations.required") },
@@ -103,7 +105,12 @@ const rules = computed<FormValidation<UnwrapRef<typeof state>>>(() => ({
103105
{ required: true, message: t("validations.required") },
104106
{ type: "number", message: t("validations.number") },
105107
],
106-
notes: [{ max: 512, message: t("validations.maxLength", { max: 512 }) }],
108+
notes: [
109+
{
110+
max: MAX_NOTES_LENGTH,
111+
message: t("validations.maxLength", { max: MAX_NOTES_LENGTH }),
112+
},
113+
],
107114
type: [
108115
{ required: true, message: t("validations.required") },
109116
{
@@ -291,7 +298,7 @@ watch(shortcuts, async () => {
291298
name="notes"
292299
type="textarea"
293300
:autosize="{ minRows: 4, maxRows: 16 }"
294-
:maxlength="512"
301+
:maxlength="MAX_NOTES_LENGTH"
295302
show-word-limit
296303
/>
297304
</el-form-item>

0 commit comments

Comments
 (0)