YouTag
YouTag copied to clipboard
Library backup
The library can be backed up by a simple json that contains all songs' id and other string information (no thumbnail image) or some special string representation of the library. This string can be saved or shared with others. To restore library, you would paste this string into the app and it would automatically go through each song, download it using the id then modify its details to match the backup string.
Issue #37 has a good discussion about SwiftNIO and some links to forks with most of the work done. @jseibert had most of it working IIRC.
Thanks @paulofaria for the quick answer ! I have been looking into #37 and also compared a lot to the GraphQL-js.
The problem is that a futures result is a future. And I think if I can get that resolved, somehow all the tests passes.
Maybe @jseibert can help me out so we can finish it?
@kimdv can you give more details as to what problem you're facing? Generally, yes, you want the result to be a future, so I'm confused.
If you're willing to take a vapor/core dependency, https://github.com/digits-labs/graphiti https://github.com/digits-labs/graphql are now rock-solid for me. (Ignore the readme's, I haven't updated them)
You need to route the futures all the way through, i.e. graphql(...)
returns an EventLoopFuture<Map>
In Graphiti, the schema-builders support both future fields, and normal fields:
try builder.field(name: "organization", futureType: Organization.self) { (selfInstance, _: NoArguments, req: Request, _) in
// Returns an EventLoopFuture<Organization>
return try selfInstance.organization.get(on: req)
}
try builder.field(name: "name", type: String.self) { (selfInstance, _: NoArguments, req: Request, _) in
// Returns a String directly, no future needed.
return selfInstance.name
}
In Vapor, the Request object is an EventLoopGroup, which I have forcibly routed through as the Context param.
Maybe I'm misunderstanding something.
I try to update the tests, and the test crashes:
As you can see on the attached screenshot, the value for __schema
is a <EventLoopFuture<Any?>
Either I need to update the test or I'm doing something wong.. :)

Looks like your implementation isn't entirely correct. Data should be a Future<[String: Any]>
, not a [String: Future<Any>]
. You need to flatten the dictionary futures.
@jseibert I found a solution. Using Vapors/Core flatMap solved all my problems
@paulofaria I also have Graphiti ready and updated to use Future
This is great! I'm a bit off the grid now so I can't properly review everything. I'll review everything by sunday though. Thanks a lot!