Created
September 6, 2013 14:41
-
-
Save ybigus/6464779 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Tables":[ | |
{ | |
"Name": "users", | |
"Fields": [ | |
{"Name": "ID", "Type": "integer", "NotNull": true, "PrimaryKey":true, "Identity":true}, | |
{"Name": "UserEmail", "Type": "nvarchar(256)", "Unique":true}, | |
{"Name": "Password", "Type": "nvarchar(64)"}, | |
{"Name": "Token", "Type": "uniqueidentifier"} | |
] | |
}, | |
{ | |
"Name": "tasks", | |
"Fields": [ | |
{"Name": "ID", "Type": "integer", "NotNull": true, "PrimaryKey":true, "Identity":true}, | |
{"Name": "Task", "Type": "nvarchar(max)"}, | |
{"Name": "DueDate", "Type": "date"}, | |
{"Name": "UserId", "Type": "integer", "References":{"Table":"users", "ForeignKey":"ID","OnDeleteCascade":true} }, | |
{"Name": "Done", "Type": "bit"} | |
] | |
} | |
], | |
"StoredProcs":[ | |
{ | |
"Name": "spLogin", | |
"Parameters": [{"Name":"login", "Type":"nvarchar(256)"},{"Name":"password", "Type":"nvarchar(64)"}], | |
"SqlQuery": "SELECT * from users where UserEmail=@login and Password=@password", | |
"Rules": ["{{AllowAll}}"] | |
}, | |
{ | |
"Name": "spGetUserByToken", | |
"Parameters": [{"Name":"token", "Type":"nvarchar(36)"}], | |
"SqlQuery": "SELECT * from users where Token=CAST(@token AS UNIQUEIDENTIFIER)", | |
"Rules": ["{{AllowAll}}"] | |
}, | |
{ | |
"Name": "spUserExists", | |
"Parameters": [{"Name":"login", "Type":"nvarchar(256)"}], | |
"SqlQuery": "SELECT UserEmail from users where UserEmail=@login", | |
"Rules": ["{{AllowAll}}"] | |
}, | |
{ | |
"Name": "spRegister", | |
"Parameters": [{"Name":"login", "Type":"nvarchar(256)"},{"Name":"password", "Type":"nvarchar(64)"}], | |
"SqlQuery": "INSERT users output inserted.Token VALUES(@login, @password, NewID())", | |
"Rules": ["{{AllowAll}}"] | |
}, | |
{ | |
"Name": "spAddTask", | |
"Parameters": [{"Name":"task", "Type":"nvarchar(max)"},{"Name":"dueDate", "Type":"date"},{"Name":"userId", "Type":"integer"},{"Name":"done","Type":"bit"}], | |
"SqlQuery": "INSERT tasks OUTPUT Inserted.ID VALUES(@task, @dueDate, @userId,@done)", | |
"Rules": ["{{!Auth}}"] | |
}, | |
{ | |
"Name": "spUpdateTask", | |
"Parameters": [{"Name":"taskId", "Type":"integer"},{"Name":"userId", "Type":"integer"},{"Name":"done","Type":"bit"}], | |
"SqlQuery": "UPDATE tasks Set Done=@done Where ID=@taskId and UserId=@userId", | |
"Rules": ["{{!Auth}}"] | |
}, | |
{ | |
"Name": "spListTasks", | |
"Parameters": [{"Name":"userId", "Type":"integer"}], | |
"SqlQuery": "SELECT * from tasks Where UserId=@userId", | |
"Rules": ["{{!Auth}}"] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment