WebService Logicsdfds

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Data Structures

Users
1. UserID: AutoNumber
2. UserEmail : String(200)
3. UserName : String(200)
Article
4. ArticleID: AutoNumber
5. Day: Number
6. Caption: String (200)
7. Description: String (200)
8. Active: Bit/Boolean (Y/N)
9. ImageName : String (100)
Article Sections
1. SectionID : Number
2. ArticleID: Number
3. SectionNumber : Number
4. Section Description: Description (2000)
Actions
1. SectionID: Number
2. ActionID: Number
3. ActionDesctiption : String (2000)
4. Active (Y/N)
Growth
1. GrowthID : Autonumber
2. UserID : String (200)
3. Date : DateTime
4. Height: Decimal
5. Weight: Decimal

6. Head: Decimal
Sample Data
Articles
ArticleID
1

Day
1

Article Sections
SectionID
ArticleID

Caption
5 Best Destinations of the
world
10 Best-Selling Products Of All
Time
35 fantastic free Android
games

SectionNu
mber
1

Description
Last updated on November 5
in Travel
By Silicon India

Active
1
1

ImageName
Toptraveldestinations.jp
g
TopProducts.jpeg

Fun doesnt have to require


funding. Got an Android phone
or tablet? Then these are the
greatest games gratis!

Andriod Games

Caption

Description

Active

ImageName

Cape Town,
South Africa

Capetown1.jpg

Sydney
Australia

The most southern point of Africa where


you can see whales and dolphins, go to
the top of Table Mountain and see
spectacular views or enjoy a visit to one
of the many vineyards and taste some
of the best wines produced in the world
today. Robben Island, the historic prison
where Nelson Mandela was held, is a
must do, for any visitor.
Be a beach bum in the morning, tourist
in the afternoon and culture vulture in
the evening in Sydney you can be
whatever you want to be and still
manage to blend in. This city is often
the first port of call for visitors and it

Sydney.jpg

Machu
Picchu, Peru

PlayStation

Lipitor

BADLAND

rolls out a brilliant welcome mat. Sydney


Opera House, Manly Beach and the Blue
Mountains are just a snippet of the list
of things to do here.
This destination offers access to what
remains of one of the most fascinating
extinct cultures and to the shrinking
Amazonian jungle. The local people are
proud to share their heritage with
visitors and to guide those that are
interested through the more remote
areas to scenery that few places can
compete with.
PlayStation that was ranked at the tenth
position on the list is a series of video
game consoles created and developed
by Sony Computer Entertainment. The
brand, which was first introduced in
1994 in Japan, has dominated the fifth,
sixth, seventh and eighth generations of
video gaming.
Lipitor, which came ninth on the list of
10 Best-selling Products of All Time
compiled by 247wallst.com, is a trade
name of a calcium salt (Atorvastatin)
marketed by Pfizer. This drug, which is a
member of the drug class known as
statins, is used for lowering the level of
LDLthe so called bad cholesterolin
the blood. The drug also stabilizes
plaque and prevents strokes through
anti-inflammatory
and
other
mechanisms.
Quite beautiful, is Badland. Its a
physics-based
auto-scrolling
game
where you push a bat-like creature

NULL

Paystation.jpg

Lipitor.jpg

NULL

Actions
ActionID
1
2
3

AIRBORNE

SectionI
D
1
1
1

Description
Action1
Action2
Action3

through a series of atmospheric,


silhouetted levels (and yeah, before you
say it, we know its look is heavily
inspired by Limbo).
iven that this is the eighth title in the
Asphalt series, it probably comes as no
surprise Gameloft's got a bit bored
having sports cars merely zoom along at
breakneck speeds and drift for ludicrous
distances.

Airborne.jpg

Activ
e
1
1
1

WebService 1 : GetArticleoftheDay
This is an Article of the day Web Service. So once the User logs in the article of the day is presented. Logic
would be different if User logs in more than one time a day into the application or logs in after a few days
gap. There would be at least one article for each day and it could grow to many articles for one day. The
maximum number is not restricted but typically would be to a maximum of 10. The articles are identified
based on Application ID. There are multiple scenarios that need to be configured: 1. User logs in once everyday into the application: First available article (least article ID) is downloaded.
2. User logs in multiple times during the day: On each login the next available article (next higher article
ID for same day) of the day is downloaded until maximum articles are downloaded. Once maximum
number is reached, null is returned.
3. If the User logs in after multiple days, the counter begins from the last article downloaded by User and
is incremented every time he logs in until the counter reaches current.

Inputs :
{{Day}} (This is the day article needs to be downloaded for)
{{PreviousArticleID}} (This is the last article displayed to User)
Output
Article ID, Article Caption, Article Description , ImageName
Algorithm to retrieve ArticleID
1. Find Article.day for PreviousArticleID
2. If Article.day = {{Day}} then find next higher value for Article.day
a. If next higher value not found return NULL
b. If next higher value found return the values for that Article ID
3. If Article.day < {{Day}} then find next higher value for Article.day
a. If next higher value not found then increment Article.day by 1 and return first ArticleID Values.
b. If next higher value is found then return Article values

WebService 2 : GetArticleDetails
Input : {{ArticleID}}
Output:
<Article>
<ArticleInformation>Article ID, Article Caption, Article Description , ImageName
<SectionInformation>SectionNumber, Caption, Description, ImageName
<Actions>ActionID, Description</Actions>
</SectionInformation>

<SectionInformation>SectionNumber, Caption, Description, ImageName</SectionInformation>


<SectionInformation>SectionNumber, Caption, Description, ImageName</SectionInformation>
<SectionInformation>SectionNumber, Caption, Description, ImageName</SectionInformation>
</ArticleInformation>
</Article>
Get Article and corresponding actions values for parameter Article ID
WebService 3 : InsertIntoGrowth
Input :
{{UserID}}
{{Date}}
{{Height}}
{{Weight}}
{{Head}}
Output
BOOL (Y/N)
Insert into growth table and return success/failure value
WebService 4 : GetGrowthValues
Input :
{{UserID}}
Output
{{Date}}

{{Height}}
{{Weight}}
{{Head}}
Get array of values for the parameter UserId
Scope of work
1. Create an architecture on Node.js on Express
2. Create the Web Services
3. Create data structure on Mongo DB
4. Recommend hosting solution. I think http://heroku.com is good but open to suggestion.
5. Host the webservices and DB
6. Unit Test the webservices with some sample data

You might also like