-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuestion.swift
51 lines (47 loc) · 1.74 KB
/
Question.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// Q.swift
// App
//
// Created by Sina khanjani on 12/18/1398 AP.
//
// Custom message response to request
// Set timer for send sms code expired date
// Update database without rm docker db
// Delete last jwt token when new token generate *
//func authorizedUser() throws -> Future<User> {
// let userID = try TokenHelpers.getUserID(fromPayloadOf: self.token)
// return User.find(userID, on: self)
// .unwrap(or: Abort(.unauthorized, reason: "Authorized user not found"))
//}
// func getHandler(_ request: Request) throws -> Future<[Mag.Public]> {
// let builder = SwifQLSelectBuilder()
// builder.select(Tag.table.*)
// let publics = builder.build()
// .from(MagTagPivot.table)
// .join(.inner, Tag.table, on: \MagTagPivot.tagID == \Tag.id)
// .limit(100)
// .offset(0)
// .execute(on: request, as: .psql)
// .all(decoding: Tag.self)
// .flatMap(to: [Mag.Public].self) { (tags) in
// return Mag.query(on: request)
// .all()
// .map(to: [Mag.Public].self) { (mags) in
// let pubs = mags.map { mag in
// mag.convertToPublic(tags: tags)
// }
// return pubs
// }
// }
// return publics
// }
// func getHandler(_ request: Request) throws -> Future<[Mag]> {
// let _ = SwifQL.select(\Mag.title,\Mag.type,\Mag.id,\Mag.description)
// let builder = SwifQLSelectBuilder()
// builder.where(\User.id == 1)
// builder.from(Mag.table)
// builder.limit(1)
// builder.select(Mag.table.*)
// let query = builder.build()
// return query.execute(on: request, as: .psql).all(decoding: Mag.self)
// }