Skip to content

Commit b092001

Browse files
author
Hamid Tavakoli
committed
fix: wip
1 parent 81a6681 commit b092001

File tree

6 files changed

+197
-256
lines changed

6 files changed

+197
-256
lines changed

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import assert from "assert";
22

33
export const ENV = <string>process.env.ENV || "local";
44
export const GRPC_SERVER_HOST = process.env.GRPC_SERVER_HOST || "localhost";
5-
export const GRPC_SERVER_PORT = process.env.GRPC_SERVER_PORT || 9091;
5+
export const GRPC_SERVER_PORT = process.env.GRPC_SERVER_PORT || 9090;
66

77
export const GRPC_RDB_SERVER_HOST = process.env.GRPC_RDB_SERVER_HOST;
88
export const GRPC_RDB_SERVER_PORT = process.env.GRPC_RDB_SERVER_PORT;

src/models/domain-layer/legacy/long_component_state.ts

Lines changed: 21 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* eslint-disable */
2-
import { ScanCriteria } from "@topcoder-framework/lib-common";
32
import _m0 from "protobufjs/minimal";
43

54
export interface LongComponentState {
@@ -24,11 +23,7 @@ export interface CreateLongComponentStateInput {
2423
}
2524

2625
export interface UpdateLongComponentStateInput {
27-
filterCriteria: ScanCriteria[];
28-
updateInput?: UpdateLongComponentStateInput_UpdateInput;
29-
}
30-
31-
export interface UpdateLongComponentStateInput_UpdateInput {
26+
longComponentStateId: number;
3227
submissionNumber?: number | undefined;
3328
points?: number | undefined;
3429
}
@@ -278,16 +273,19 @@ export const CreateLongComponentStateInput = {
278273
};
279274

280275
function createBaseUpdateLongComponentStateInput(): UpdateLongComponentStateInput {
281-
return { filterCriteria: [], updateInput: undefined };
276+
return { longComponentStateId: 0, submissionNumber: undefined, points: undefined };
282277
}
283278

284279
export const UpdateLongComponentStateInput = {
285280
encode(message: UpdateLongComponentStateInput, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
286-
for (const v of message.filterCriteria) {
287-
ScanCriteria.encode(v!, writer.uint32(10).fork()).ldelim();
281+
if (message.longComponentStateId !== 0) {
282+
writer.uint32(8).int32(message.longComponentStateId);
288283
}
289-
if (message.updateInput !== undefined) {
290-
UpdateLongComponentStateInput_UpdateInput.encode(message.updateInput, writer.uint32(26).fork()).ldelim();
284+
if (message.submissionNumber !== undefined) {
285+
writer.uint32(16).int32(message.submissionNumber);
286+
}
287+
if (message.points !== undefined) {
288+
writer.uint32(24).int32(message.points);
291289
}
292290
return writer;
293291
},
@@ -300,10 +298,13 @@ export const UpdateLongComponentStateInput = {
300298
const tag = reader.uint32();
301299
switch (tag >>> 3) {
302300
case 1:
303-
message.filterCriteria.push(ScanCriteria.decode(reader, reader.uint32()));
301+
message.longComponentStateId = reader.int32();
302+
break;
303+
case 2:
304+
message.submissionNumber = reader.int32();
304305
break;
305306
case 3:
306-
message.updateInput = UpdateLongComponentStateInput_UpdateInput.decode(reader, reader.uint32());
307+
message.points = reader.int32();
307308
break;
308309
default:
309310
reader.skipType(tag & 7);
@@ -315,25 +316,17 @@ export const UpdateLongComponentStateInput = {
315316

316317
fromJSON(object: any): UpdateLongComponentStateInput {
317318
return {
318-
filterCriteria: Array.isArray(object?.filterCriteria)
319-
? object.filterCriteria.map((e: any) => ScanCriteria.fromJSON(e))
320-
: [],
321-
updateInput: isSet(object.updateInput)
322-
? UpdateLongComponentStateInput_UpdateInput.fromJSON(object.updateInput)
323-
: undefined,
319+
longComponentStateId: isSet(object.longComponentStateId) ? Number(object.longComponentStateId) : 0,
320+
submissionNumber: isSet(object.submissionNumber) ? Number(object.submissionNumber) : undefined,
321+
points: isSet(object.points) ? Number(object.points) : undefined,
324322
};
325323
},
326324

327325
toJSON(message: UpdateLongComponentStateInput): unknown {
328326
const obj: any = {};
329-
if (message.filterCriteria) {
330-
obj.filterCriteria = message.filterCriteria.map((e) => e ? ScanCriteria.toJSON(e) : undefined);
331-
} else {
332-
obj.filterCriteria = [];
333-
}
334-
message.updateInput !== undefined && (obj.updateInput = message.updateInput
335-
? UpdateLongComponentStateInput_UpdateInput.toJSON(message.updateInput)
336-
: undefined);
327+
message.longComponentStateId !== undefined && (obj.longComponentStateId = Math.round(message.longComponentStateId));
328+
message.submissionNumber !== undefined && (obj.submissionNumber = Math.round(message.submissionNumber));
329+
message.points !== undefined && (obj.points = Math.round(message.points));
337330
return obj;
338331
},
339332

@@ -345,74 +338,7 @@ export const UpdateLongComponentStateInput = {
345338
object: I,
346339
): UpdateLongComponentStateInput {
347340
const message = createBaseUpdateLongComponentStateInput();
348-
message.filterCriteria = object.filterCriteria?.map((e) => ScanCriteria.fromPartial(e)) || [];
349-
message.updateInput = (object.updateInput !== undefined && object.updateInput !== null)
350-
? UpdateLongComponentStateInput_UpdateInput.fromPartial(object.updateInput)
351-
: undefined;
352-
return message;
353-
},
354-
};
355-
356-
function createBaseUpdateLongComponentStateInput_UpdateInput(): UpdateLongComponentStateInput_UpdateInput {
357-
return { submissionNumber: undefined, points: undefined };
358-
}
359-
360-
export const UpdateLongComponentStateInput_UpdateInput = {
361-
encode(message: UpdateLongComponentStateInput_UpdateInput, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
362-
if (message.submissionNumber !== undefined) {
363-
writer.uint32(8).int32(message.submissionNumber);
364-
}
365-
if (message.points !== undefined) {
366-
writer.uint32(16).int32(message.points);
367-
}
368-
return writer;
369-
},
370-
371-
decode(input: _m0.Reader | Uint8Array, length?: number): UpdateLongComponentStateInput_UpdateInput {
372-
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
373-
let end = length === undefined ? reader.len : reader.pos + length;
374-
const message = createBaseUpdateLongComponentStateInput_UpdateInput();
375-
while (reader.pos < end) {
376-
const tag = reader.uint32();
377-
switch (tag >>> 3) {
378-
case 1:
379-
message.submissionNumber = reader.int32();
380-
break;
381-
case 2:
382-
message.points = reader.int32();
383-
break;
384-
default:
385-
reader.skipType(tag & 7);
386-
break;
387-
}
388-
}
389-
return message;
390-
},
391-
392-
fromJSON(object: any): UpdateLongComponentStateInput_UpdateInput {
393-
return {
394-
submissionNumber: isSet(object.submissionNumber) ? Number(object.submissionNumber) : undefined,
395-
points: isSet(object.points) ? Number(object.points) : undefined,
396-
};
397-
},
398-
399-
toJSON(message: UpdateLongComponentStateInput_UpdateInput): unknown {
400-
const obj: any = {};
401-
message.submissionNumber !== undefined && (obj.submissionNumber = Math.round(message.submissionNumber));
402-
message.points !== undefined && (obj.points = Math.round(message.points));
403-
return obj;
404-
},
405-
406-
create<I extends Exact<DeepPartial<UpdateLongComponentStateInput_UpdateInput>, I>>(
407-
base?: I,
408-
): UpdateLongComponentStateInput_UpdateInput {
409-
return UpdateLongComponentStateInput_UpdateInput.fromPartial(base ?? {});
410-
},
411-
412-
fromPartial<I extends Exact<DeepPartial<UpdateLongComponentStateInput_UpdateInput>, I>>(
413-
object: I,
414-
): UpdateLongComponentStateInput_UpdateInput {
415-
const message = createBaseUpdateLongComponentStateInput_UpdateInput();
341+
message.longComponentStateId = object.longComponentStateId ?? 0;
416342
message.submissionNumber = object.submissionNumber ?? undefined;
417343
message.points = object.points ?? undefined;
418344
return message;

src/models/domain-layer/legacy/services/upload.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
/* eslint-disable */
22
import { handleUnaryCall, UntypedServiceImplementation } from "@grpc/grpc-js";
3-
import { CreateResult, LookupCriteria, ScanRequest, ScanResult, UpdateResult } from "@topcoder-framework/lib-common";
3+
import {
4+
CreateResult,
5+
Empty,
6+
LookupCriteria,
7+
ScanRequest,
8+
ScanResult,
9+
UpdateResult,
10+
} from "@topcoder-framework/lib-common";
411
import { CreateUploadInput, UpdateUploadInput, Upload } from "../upload";
512

613
export type LegacyUploadService = typeof LegacyUploadService;
@@ -41,11 +48,21 @@ export const LegacyUploadService = {
4148
responseSerialize: (value: UpdateResult) => Buffer.from(UpdateResult.encode(value).finish()),
4249
responseDeserialize: (value: Buffer) => UpdateResult.decode(value),
4350
},
51+
delete: {
52+
path: "/topcoder.domain.service.legacy_upload.LegacyUpload/Delete",
53+
requestStream: false,
54+
responseStream: false,
55+
requestSerialize: (value: LookupCriteria) => Buffer.from(LookupCriteria.encode(value).finish()),
56+
requestDeserialize: (value: Buffer) => LookupCriteria.decode(value),
57+
responseSerialize: (value: Empty) => Buffer.from(Empty.encode(value).finish()),
58+
responseDeserialize: (value: Buffer) => Empty.decode(value),
59+
},
4460
} as const;
4561

4662
export interface LegacyUploadServer extends UntypedServiceImplementation {
4763
scan: handleUnaryCall<ScanRequest, ScanResult>;
4864
lookup: handleUnaryCall<LookupCriteria, Upload>;
4965
create: handleUnaryCall<CreateUploadInput, CreateResult>;
5066
update: handleUnaryCall<UpdateUploadInput, UpdateResult>;
67+
delete: handleUnaryCall<LookupCriteria, Empty>;
5168
}

0 commit comments

Comments
 (0)