πWork Record Smart Contract
This contract stores all the Services or Jobs of a Freelance Experience of the user .
Structure
Example
Field Semantics
workRecordId: Work Record Identificator. This value is assigned correlatively by the Smart Contract.
experienceId: Experience Identificator. The Experience must be freelancer.
user: Address of the user. Owner of the record.
consumer: Name of the consumer of the service. It's just descriptive, this Work Record cannot be verified if this field is used. Must be empty if a Consumer Address is provided.
consumerAddress: Address of the consumer of the service. Must be provided by the consumer itself. The owner of this address can verify the Work Record. Could be empty if the consumer have no address (consumer field is used instead).
platformAddress: Address of the platform that mediate in the service. Must be provided by the platform itself. If the service is done using a platform like Upwork or Fiverr, it's unlikely that the consumer could validate this service. But, in this case, is the platform itself who validate it.
title: Title of the service.
description: Describe the service/job with more details.
tags: Keywords that match with this service. They are just descriptive. It would be used to search and classificate the services.
startDate: Date when the Work Record began. Store as Unix Timestamp (Seconds since Jan-01-1970). Mandatory field. Must be greater than the Experience startDate.
endDate: Date when the Work Record ended. Store as Unix Timestamp (Seconds since Jan-01-1970). Could be 0 if the Work Record has not ended yet. Must be greater than startDate.
status: current Work Record Status (Pending - Completed - Cancelled).
price: Amount charged in USD. Store as cents (1 USD = 100).
hoursWorked: Amount of hours used to complete the service.
calification: Consumer calification for the service. Store in basis points (1 = 100). Must be between 0 and 500 (0 - 5). Must be provided only when an endDate is provided.
consumerValidation: If a consumerAddress is provided, the owner of it can validate the Work Record.
consumerComments: Consumer comments about the service. Must be provided only when an endDate is provided.
skills: Skills used for this Work Record.
moreInfoLink: Link to an optional metadata. Typically this link will point to a JSON with different fields for any kind of metadata (Photos, Videos, Informative Fields, etc).
Functions
addWorkRecord: Adds a new Work Record.
updateWorkRecord: Updates an existing Work Record.
endWorkRecord: Ends an existing Work Record.
deleteWorkRecord: Deletes an existing Work Record.
updateWorkRecordValidation: Validates an existing Work Record.
cancelWorkRecord: Cancels an existing Work Record.
Validation Rules
The are several rules that a Work Record must follow to ensure a consistent state. This apply to addWorkRecord, updateWorkRecord and endWorkRecord operation.
User address must match Experience user address.
Experience must be freelance.
Must specify either a consumer name or a consumer address (one or another, not both).
User address must be different from consumer address and platform address.
Title must not be empty.
Description must not be empty.
StartDate must not be empty.
Work Record dates must be within the Experience dates.
EndDate must be greater than startDate.
Calification must not be greater than 500.
Last updated