Skip to content

Commit f19cee9

Browse files
authored
Update README.md
1 parent 06c9fe5 commit f19cee9

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

README.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Documentation](http://img.shields.io/badge/read-docs-2196f3.svg)](https://swiftpackageindex.com/netreconlab/parse-server-swift/documentation)
44
[![Tuturiol](http://img.shields.io/badge/read-tuturials-2196f3.svg)](https://netreconlab.github.io/parse-server-swift/release/tutorials/parseserverswift/)
55
[![Build Status CI](https://github.com/netreconlab/parse-server-swift/workflows/ci/badge.svg?branch=main)](https://github.com/netreconlab/parse-server-swift/actions?query=workflow%3Aci+branch%3Amain)
6+
[![release](https://github.com/netreconlab/parse-server-swift/actions/workflows/release.yml/badge.svg)](https://github.com/netreconlab/parse-server-swift/actions/workflows/release.yml)
67
[![codecov](https://codecov.io/gh/netreconlab/parse-server-swift/branch/main/graph/badge.svg?token=RC3FLU6BGW)](https://codecov.io/gh/netreconlab/parse-server-swift)
78
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fnetreconlab%2Fparse-server-swift%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/netreconlab/parse-server-swift)
89
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fnetreconlab%2Fparse-server-swift%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/netreconlab/parse-server-swift)
@@ -80,7 +81,36 @@ To start your server type, `swift run` in the terminal of the project root direc
8081

8182
## Writing Cloud Code
8283
### Creating `ParseObject`'s
83-
It is recommended to add all of your `ParseObject`'s in a folder called `Models` similar to [ParseServerSwift/Sources/ParseServerSwift/Models](https://github.com/netreconlab/ParseServerSwift/blob/main/Sources/ParseServerSwift/Models). For example, the `GameScore` model is below:
84+
It is recommended to add all of your `ParseObject`'s in a folder called `Models` similar to [ParseServerSwift/Sources/ParseServerSwift/Models](https://github.com/netreconlab/ParseServerSwift/blob/main/Sources/ParseServerSwift/Models).
85+
86+
#### The `ParseUser` Model
87+
Be mindful that the `ParseUser` in `ParseServerSwift` should conform to [ParseCloudUser](https://swiftpackageindex.com/netreconlab/parse-swift/4.16.2/documentation/parseswift/parseclouduser). In addition, make sure to add all of the additional properties you have in your `_User` class to the `User` model. An example `User` model is below:
88+
89+
```swift
90+
/**
91+
An example `ParseUser`. You will want to add custom
92+
properties to reflect the `ParseUser` on your Parse Server.
93+
*/
94+
struct User: ParseCloudUser {
95+
96+
var authData: [String: [String: String]?]?
97+
var username: String?
98+
var email: String?
99+
var emailVerified: Bool?
100+
var password: String?
101+
var objectId: String?
102+
var createdAt: Date?
103+
var updatedAt: Date?
104+
var ACL: ParseACL?
105+
var originalData: Data?
106+
var sessionToken: String?
107+
var _failed_login_count: Int?
108+
var _account_lockout_expires_at: Date?
109+
}
110+
```
111+
112+
#### An example `ParseObject`
113+
The `GameScore` model is below:
84114

85115
```swift
86116
import Foundation
@@ -113,9 +143,6 @@ struct GameScore: ParseObject {
113143
}
114144
```
115145

116-
#### The `ParseUser` Model
117-
Be sure to add all of the additional properties you have in your `_User` class to the `User` model. An example `User` model can be found at [ParseServerSwift/Sources/ParseServerSwift/Models/User.swift](https://github.com/netreconlab/ParseServerSwift/blob/main/Sources/ParseServerSwift/Models/User.swift)
118-
119146
### Creating New Cloud Code Routes
120147
Adding routes for `ParseHooks` are as simple as adding [routes in Vapor](https://docs.vapor.codes/basics/routing/). `ParseServerSwift` provides some additional methods to routes to easily create and register [Hook Functions](https://parseplatform.org/Parse-Swift/release/documentation/parseswift/parsehookfunctionable) and [Hook Triggers](https://parseplatform.org/Parse-Swift/release/documentation/parseswift/parsehooktriggerable/). All routes should be added to the `routes.swift` file in your project. Example `ParseServerSwift` routes can be found in [ParseServerSwift/Sources/ParseServerSwift/routes.swift](https://github.com/netreconlab/ParseServerSwift/blob/main/Sources/ParseServerSwift/routes.swift).
121148

0 commit comments

Comments
 (0)