Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
this._orderStatus = orderStatus;
}
@Property()
get vehicleDetails(): IVehicleDetails {
return this._vehicleDetails;
}
@Property()
get ordererId(): string {
return this._ordererId;
}
@Property()
get vin(): string {
return this._vin;
}
set vin(vin: string) {
this._vin = vin;
}
public madeByOrg(orgId: string) {
return this.vehicleDetails.makeId === orgId;
}
}
// tslint:disable:max-classes-per-file
@Object()
export class HistoricOrder extends HistoricState {
const text = greeting.text;
if (text.length !== greeting.textLength) {
throw new Error('Length incorrectly set');
}
if (text.split(' ').length !== greeting.wordCount) {
throw new Error('Word count incorrectly set');
}
}
@Property('text')
private text: string;
@Property('length')
private textLength: number;
@Property('wordcount')
private wordCount: number;
constructor(text: string) {
this.text = text;
this.textLength = text.length;
this.wordCount = text.split(' ').length;
}
public setText(text: string): void {
this.text = text;
}
public getText(): string {
throw new Error('Length incorrectly set');
}
if (text.split(' ').length !== greeting.wordCount) {
throw new Error('Word count incorrectly set');
}
}
@Property('text')
private text: string;
@Property('length')
private textLength: number;
@Property('wordcount')
private wordCount: number;
constructor(text: string) {
this.text = text;
this.textLength = text.length;
this.wordCount = text.split(' ').length;
}
public setText(text: string): void {
this.text = text;
}
public getText(): string {
return this.text;
}
export default class Greeting {
public static validate(greeting: Greeting) {
const text = greeting.text;
if (text.length !== greeting.textLength) {
throw new Error('Length incorrectly set');
}
if (text.split(' ').length !== greeting.wordCount) {
throw new Error('Word count incorrectly set');
}
}
@Property('text')
private text: string;
@Property('length')
private textLength: number;
@Property('wordcount')
private wordCount: number;
constructor(text: string) {
this.text = text;
this.textLength = text.length;
this.wordCount = text.split(' ').length;
}
public setText(text: string): void {
this.text = text;
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import { Object, Property } from 'fabric-contract-api';
@Object()
export class IOptions {
@Property()
public trim: string;
@Property()
public interior: string;
@Property('extras', 'string[]')
public extras: string[];
}
vehicleStatus: VehicleStatus,
manufactured: number,
@NotRequired ownerId?: string,
) {
super(id, Vehicle.name);
this.vehicleDetails = vehicleDetails;
this._vehicleStatus = vehicleStatus;
this.manufactured = manufactured;
if (ownerId) {
this._ownerId = ownerId;
}
}
@Property()
get ownerId(): string {
return this._ownerId;
}
set ownerId(ownerId: string) {
this._ownerId = ownerId;
}
@Property()
get vehicleStatus(): VehicleStatus {
return this._vehicleStatus;
}
set vehicleStatus(status: VehicleStatus) {
this._vehicleStatus = status;
}
if (ownerId) {
this._ownerId = ownerId;
}
}
@Property()
get ownerId(): string {
return this._ownerId;
}
set ownerId(ownerId: string) {
this._ownerId = ownerId;
}
@Property()
get vehicleStatus(): VehicleStatus {
return this._vehicleStatus;
}
set vehicleStatus(status: VehicleStatus) {
this._vehicleStatus = status;
}
public madeByOrg(orgId: string) {
return this.vehicleDetails.makeId === orgId;
}
}
import { NetworkName } from '../../constants';
import { State } from '../ledger-api/state';
@ContractObject()
export class Participant extends State {
public static generateClass(participantType: string): string {
return NetworkName + '.participants.' + participantType;
}
@Property()
public readonly id: string;
@Property()
public readonly orgId: string;
@Property('roles', 'string[]')
protected roles: string[];
constructor(
id: string, roles: string[], orgId: string, participantType: string,
) {
super(Participant.generateClass(participantType), [id]);
this.id = id;
this.roles = roles;
this.orgId = orgId;
}
public serialize(): Buffer {
const toSerialize = JSON.parse(State.serialize(this).toString());
Object.keys(this).forEach((key) => {
if (key.startsWith('_')) {
return this._orderStatus;
}
set orderStatus(orderStatus: OrderStatus) {
if (orderStatus <= this._orderStatus) {
throw new Error('Status of order cannot go backwards or remain the same');
}
if (orderStatus - this._orderStatus !== 1) {
throw new Error('Cannot skip order status step');
}
this._orderStatus = orderStatus;
}
@Property()
get vehicleDetails(): IVehicleDetails {
return this._vehicleDetails;
}
@Property()
get ordererId(): string {
return this._ordererId;
}
@Property()
get vin(): string {
return this._vin;
}
set vin(vin: string) {
this._vin = vin;
throw new Error('Status of order cannot go backwards or remain the same');
}
if (orderStatus - this._orderStatus !== 1) {
throw new Error('Cannot skip order status step');
}
this._orderStatus = orderStatus;
}
@Property()
get vehicleDetails(): IVehicleDetails {
return this._vehicleDetails;
}
@Property()
get ordererId(): string {
return this._ordererId;
}
@Property()
get vin(): string {
return this._vin;
}
set vin(vin: string) {
this._vin = vin;
}
public madeByOrg(orgId: string) {
return this.vehicleDetails.makeId === orgId;
}