Skip to content

Commit

Permalink
feat: change function
Browse files Browse the repository at this point in the history
  • Loading branch information
Senna46 committed Sep 29, 2023
1 parent 50afa88 commit 7a43919
Show file tree
Hide file tree
Showing 16 changed files with 850 additions and 0 deletions.
12 changes: 12 additions & 0 deletions common/proto/auto_order_change/auto_order_change.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
syntax = "proto3";
package main;

import "firebase_rules_options.proto";

option (google.firebase.rules.firebase_rules).full_package_names = true;

message AutoOrderChange {
string id = 1;
string student_account_id = 2;
bool enabled = 3;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { FirestoreDataConverter } from 'firebase/firestore';
import { AutoOrderChange } from './auto-order-change';


export class AutoOrderChangeFirestore {
static collectionID = 'auto_order_changes';
static documentID = 'auto_order_change_id';
static virtualPath = `${AutoOrderChangeFirestore.collectionID}/{${AutoOrderChangeFirestore.documentID}}`;

static converter: FirestoreDataConverter<AutoOrderChange> = {
toFirestore: (data) => ({ ...data }),
fromFirestore: (snapshot, options) => {
const data = snapshot.data(options)!;
return new AutoOrderChange(data, data.created_at, data.updated_at);
}
};

static collectionPath() {
return `${AutoOrderChangeFirestore.collectionID}`;
}

static documentPath(id: string) {
return `${AutoOrderChangeFirestore.collectionPath()}/${id}`;
}
}
12 changes: 12 additions & 0 deletions common/src/entities/auto-order-changes/auto-order-change.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { proto } from '../..';
import { FieldValue, Timestamp } from 'firebase/firestore';

export class AutoOrderChange extends proto.main.AutoOrderChange {
constructor(iAutoOrderChange: proto.main.IAutoOrderChange, public created_at?: FieldValue | Timestamp, public updated_at?: FieldValue | Timestamp) {
super(iAutoOrderChange);
}

validate() {
return false;
}
}
2 changes: 2 additions & 0 deletions common/src/entities/auto-order-changes/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './auto-order-change.firestore';
export * from './auto-order-change';
1 change: 1 addition & 0 deletions common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ export * from './entities/monthly-settlements';
export * from './entities/xrpl-txs';
export * from './entities/xrpl-monthly-txs';
export * from './entities/primary-ask-settings';
export * from './entities/auto-order-changes';
220 changes: 220 additions & 0 deletions common/src/proto.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,226 @@
return AdminPrivate;
})();

main.AutoOrderChange = (function() {

/**
* Properties of an AutoOrderChange.
* @memberof main
* @interface IAutoOrderChange
* @property {string|null} [id] AutoOrderChange id
* @property {string|null} [student_account_id] AutoOrderChange student_account_id
* @property {boolean|null} [enabled] AutoOrderChange enabled
*/

/**
* Constructs a new AutoOrderChange.
* @memberof main
* @classdesc Represents an AutoOrderChange.
* @implements IAutoOrderChange
* @constructor
* @param {main.IAutoOrderChange=} [properties] Properties to set
*/
function AutoOrderChange(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}

/**
* AutoOrderChange id.
* @member {string} id
* @memberof main.AutoOrderChange
* @instance
*/
AutoOrderChange.prototype.id = "";

/**
* AutoOrderChange student_account_id.
* @member {string} student_account_id
* @memberof main.AutoOrderChange
* @instance
*/
AutoOrderChange.prototype.student_account_id = "";

/**
* AutoOrderChange enabled.
* @member {boolean} enabled
* @memberof main.AutoOrderChange
* @instance
*/
AutoOrderChange.prototype.enabled = false;

/**
* Encodes the specified AutoOrderChange message. Does not implicitly {@link main.AutoOrderChange.verify|verify} messages.
* @function encode
* @memberof main.AutoOrderChange
* @static
* @param {main.IAutoOrderChange} message AutoOrderChange message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
AutoOrderChange.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.id != null && Object.hasOwnProperty.call(message, "id"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.id);
if (message.student_account_id != null && Object.hasOwnProperty.call(message, "student_account_id"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.student_account_id);
if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled"))
writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enabled);
return writer;
};

/**
* Encodes the specified AutoOrderChange message, length delimited. Does not implicitly {@link main.AutoOrderChange.verify|verify} messages.
* @function encodeDelimited
* @memberof main.AutoOrderChange
* @static
* @param {main.IAutoOrderChange} message AutoOrderChange message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
AutoOrderChange.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};

/**
* Decodes an AutoOrderChange message from the specified reader or buffer.
* @function decode
* @memberof main.AutoOrderChange
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {main.AutoOrderChange} AutoOrderChange
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
AutoOrderChange.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.main.AutoOrderChange();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.id = reader.string();
break;
case 2:
message.student_account_id = reader.string();
break;
case 3:
message.enabled = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};

/**
* Decodes an AutoOrderChange message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof main.AutoOrderChange
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {main.AutoOrderChange} AutoOrderChange
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
AutoOrderChange.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};

/**
* Verifies an AutoOrderChange message.
* @function verify
* @memberof main.AutoOrderChange
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
AutoOrderChange.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.id != null && message.hasOwnProperty("id"))
if (!$util.isString(message.id))
return "id: string expected";
if (message.student_account_id != null && message.hasOwnProperty("student_account_id"))
if (!$util.isString(message.student_account_id))
return "student_account_id: string expected";
if (message.enabled != null && message.hasOwnProperty("enabled"))
if (typeof message.enabled !== "boolean")
return "enabled: boolean expected";
return null;
};

/**
* Creates an AutoOrderChange message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof main.AutoOrderChange
* @static
* @param {Object.<string,*>} object Plain object
* @returns {main.AutoOrderChange} AutoOrderChange
*/
AutoOrderChange.fromObject = function fromObject(object) {
if (object instanceof $root.main.AutoOrderChange)
return object;
var message = new $root.main.AutoOrderChange();
if (object.id != null)
message.id = String(object.id);
if (object.student_account_id != null)
message.student_account_id = String(object.student_account_id);
if (object.enabled != null)
message.enabled = Boolean(object.enabled);
return message;
};

/**
* Creates a plain object from an AutoOrderChange message. Also converts values to other types if specified.
* @function toObject
* @memberof main.AutoOrderChange
* @static
* @param {main.AutoOrderChange} message AutoOrderChange
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
AutoOrderChange.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.id = "";
object.student_account_id = "";
object.enabled = false;
}
if (message.id != null && message.hasOwnProperty("id"))
object.id = message.id;
if (message.student_account_id != null && message.hasOwnProperty("student_account_id"))
object.student_account_id = message.student_account_id;
if (message.enabled != null && message.hasOwnProperty("enabled"))
object.enabled = message.enabled;
return object;
};

/**
* Converts this AutoOrderChange to JSON.
* @function toJSON
* @memberof main.AutoOrderChange
* @instance
* @returns {Object.<string,*>} JSON object
*/
AutoOrderChange.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};

return AutoOrderChange;
})();

main.AvailableBalance = (function() {

/**
Expand Down
95 changes: 95 additions & 0 deletions common/src/proto.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,101 @@ export namespace main {
public toJSON(): { [k: string]: any };
}

/** Properties of an AutoOrderChange. */
interface IAutoOrderChange {

/** AutoOrderChange id */
id?: (string|null);

/** AutoOrderChange student_account_id */
student_account_id?: (string|null);

/** AutoOrderChange enabled */
enabled?: (boolean|null);
}

/** Represents an AutoOrderChange. */
class AutoOrderChange implements IAutoOrderChange {

/**
* Constructs a new AutoOrderChange.
* @param [properties] Properties to set
*/
constructor(properties?: main.IAutoOrderChange);

/** AutoOrderChange id. */
public id: string;

/** AutoOrderChange student_account_id. */
public student_account_id: string;

/** AutoOrderChange enabled. */
public enabled: boolean;

/**
* Encodes the specified AutoOrderChange message. Does not implicitly {@link main.AutoOrderChange.verify|verify} messages.
* @param message AutoOrderChange message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: main.IAutoOrderChange, writer?: $protobuf.Writer): $protobuf.Writer;

/**
* Encodes the specified AutoOrderChange message, length delimited. Does not implicitly {@link main.AutoOrderChange.verify|verify} messages.
* @param message AutoOrderChange message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: main.IAutoOrderChange, writer?: $protobuf.Writer): $protobuf.Writer;

/**
* Decodes an AutoOrderChange message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns AutoOrderChange
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): main.AutoOrderChange;

/**
* Decodes an AutoOrderChange message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns AutoOrderChange
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): main.AutoOrderChange;

/**
* Verifies an AutoOrderChange message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);

/**
* Creates an AutoOrderChange message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns AutoOrderChange
*/
public static fromObject(object: { [k: string]: any }): main.AutoOrderChange;

/**
* Creates a plain object from an AutoOrderChange message. Also converts values to other types if specified.
* @param message AutoOrderChange
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: main.AutoOrderChange, options?: $protobuf.IConversionOptions): { [k: string]: any };

/**
* Converts this AutoOrderChange to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
}

/** Properties of an AvailableBalance. */
interface IAvailableBalance {

Expand Down
Loading

0 comments on commit 7a43919

Please sign in to comment.