Skip to content

Commit 3c987bb

Browse files
Copilothotlong
andcommitted
refactor: improve parameter naming clarity in rest-server-example
Rename 'req' to 'request' in batch operation methods for better code clarity Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent d26e088 commit 3c987bb

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

examples/features/rest-server-example.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,18 @@ class MockProtocolProvider {
105105
return { success: true };
106106
}
107107

108-
async getMetaItemCached(req: any) {
108+
async getMetaItemCached(request: any) {
109109
return {
110-
type: req.type,
111-
name: req.name,
112-
item: await this.getMetaItem(req.type, req.name),
110+
type: request.type,
111+
name: request.name,
112+
item: await this.getMetaItem(request.type, request.name),
113113
cached: false
114114
};
115115
}
116116

117-
async batchData(req: any) {
117+
async batchData(request: any) {
118118
const results = [];
119-
for (const op of req.operations || []) {
119+
for (const op of request.operations || []) {
120120
try {
121121
let result;
122122
if (op.operation === 'create') {
@@ -142,11 +142,11 @@ class MockProtocolProvider {
142142
return newRecords;
143143
}
144144

145-
async updateManyData(req: any) {
145+
async updateManyData(request: any) {
146146
const results = [];
147-
for (const id of req.ids || []) {
147+
for (const id of request.ids || []) {
148148
try {
149-
const result = await this.updateData(req.object, id, req.data);
149+
const result = await this.updateData(request.object, id, request.data);
150150
results.push({ success: true, data: result });
151151
} catch (error) {
152152
results.push({ success: false, error: (error as Error).message });
@@ -155,11 +155,11 @@ class MockProtocolProvider {
155155
return { results };
156156
}
157157

158-
async deleteManyData(req: any) {
158+
async deleteManyData(request: any) {
159159
const results = [];
160-
for (const id of req.ids || []) {
160+
for (const id of request.ids || []) {
161161
try {
162-
const result = await this.deleteData(req.object, id);
162+
const result = await this.deleteData(request.object, id);
163163
results.push({ success: true, data: result });
164164
} catch (error) {
165165
results.push({ success: false, error: (error as Error).message });

0 commit comments

Comments
 (0)