Completed

5 Javascript functions - pseudo code included

This project was successfully completed by Eswar87 for $100 USD in 3 days.

Get free quotes for a project like this
Employer working
Project Budget
$30 - $250 USD
Completed In
3 days
Total Bids
7
Project Description

We want 5 serverless Javascript functions written. Pseudo code included below. See more notes, examples below pseudo code.

AddWidParameters(inputObjectDOT) // This call accepts a list with DOT parameters and adds to mongo

inputParametersList[], commandList[] = call matchPrefix(inputObjectDOT{}, "command") // split list into commands and everything else

if commandlist[0].value["dtotype"]='' then DTOType='defaultDTO' else DTOType=commandlist[0].value["dtotype"]

DTOobject = getFromMongo(DTOType) // get DTO definition from mongo

DTOobjectDOT=converttoDOT(DTOObject)

DTOList[], DTOIndexList[], DTOoriginalList[]=removeindex(DTOobjectDOT{})

inputList[], indexList[], originalinputList[]=removeindex(inputObjectDOT{})

inputList[], DTOList[] = call splitobjectlist(inputList[], DTOList[]])

CleanInputList[]=cleanbasedoncheckflagList([url removed, login to view], inputList[], DTOList[])

Make sure originalinputList is global

AddMaster(DTOList[],CleaninputList[])

AddMaster(DTOList[],inputList[])Make sure originalinputList is global

SortedDTOList[]=SortAttributes(DTOList[])

ParentDTOList[], ChildrenDTOList[] = SplitKeywordSet(SortedDTOList[],'attribute')

ParentList[], ChildrenList[] = splitList(inputList[], ParentDTOList[])

parentwid=MongoAddEditPrepare(ParentListDTO[], ParentList[])

Repeat until ChildrenDTOList[] is empty

if ChildrentDTOList[].value = "attribute" then

RelatedListDTO[], NotRelatedListDTO[] = MatchPrefix(ChildrenDTOList[], ChildrentListDTO[].property)

RelatedListParameters[], NotRelatedListParameters[] = MatchPrefix(ChildrenParameterList[], ChildrentListParameter[].property)

ChildWid=AddMaster(RelatedListDTO[], RelatedListParameters[])

MongoAdd -- make a new relationship wid=random, primarywid= secondarywid= relationshiptype='attribute'

ChildrenDTOList[]=NotRelatedDTOList[]

ChildrenParameterList[]=NotRelatedParameterList[]

MongoAddEditPrepare(InDTO[], InList[]) in list out object

Make sure originalinputList is global

MongoType='Add'

If InDTO[1].value = 'Attribute' then toBeAdded=deletePrefix(InDTO[])

if InDTO[wid]"" then

Check in mongo to see if the wid already exists or not, if it exists then MongoType='Edit'

else InDTO[wid]=RandomWid

If OutputList[[url removed, login to view]]="" then InParam[[url removed, login to view]]=1

If OutputList[[url removed, login to view]]= then InParam[[url removed, login to view]]=current time date

if OutputList[[url removed, login to view]]="" then InParam[[url removed, login to view]]='defaultstyle'

If MongoType = 'Edit' then callmongoedit (InDTO[]) else call mongoadd (InDTO[]) // mongo add should return wid

Return wid

getfrommongo(wid)

Hard code wid values to emulate a return of parameters

mongoadd

Hard code to return wid=some random number

Example data in TAB EXAMPLE3: [url removed, login to view]

These functions, that are referenced in the 5 functions have already been written:

Functions referenced in pseudo code have already been written:

SortAttributes - accepts flat incoming parameters, produces flat parameters

SplitKeywordSet - accepts keyword & flat incoming list, produces two flat lists

MatchPrefix - accepts keyword & flat incoming list, produces two flat lists, DTOType

DeletePrefix

RemoveIndex

SplitObjectList

splitobject -accepts two flat lists, filters one from the values of the other, returns two flat lists,…original + left overs

cleanbasedonflag-accepts flag, two flat parameter lists, returns the cleaned 'ready to add' flat list

convertodot -converts to dot notation

convertfromdot -converts from dot notation

Completed by:
Skills Required

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online