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
name: Deploy to Azure | |
on: | |
push: | |
branches: | |
- master | |
env: | |
AZURE_WEBAPP_NAME: application-api | |
AZURE_WEBAPP_PACKAGE_PATH: './src/Application.Api/bin/Release/netcoreapp3.0' |
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
[ | |
{ | |
"fileName": "1.png", | |
"isPrimary": true, | |
"isForLight": true, | |
"isForDark": false, | |
"altitude": 27.95, | |
"azimuth": 279.66 | |
}, | |
{ |
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
import Foundation | |
import AppKit | |
import AVFoundation | |
extension NSImage { | |
@objc var CGImage: CGImage? { | |
get { | |
guard let imageData = self.tiffRepresentation else { return nil } | |
guard let sourceData = CGImageSourceCreateWithData(imageData as CFData, nil) else { return nil } | |
return CGImageSourceCreateImageAtIndex(sourceData, 0, nil) |
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
import Foundation | |
import AppKit | |
import AVFoundation | |
extension NSImage { | |
@objc var CGImage: CGImage? { | |
get { | |
guard let imageData = self.tiffRepresentation else { return nil } | |
guard let sourceData = CGImageSourceCreateWithData(imageData as CFData, nil) else { return nil } | |
return CGImageSourceCreateImageAtIndex(sourceData, 0, nil) |
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
public func get(request: HTTPRequest, response: HTTPResponse) { | |
do { | |
guard let stringId = request.urlVariables["id"], | |
let id = UUID(uuidString: stringId) else { | |
return response.sendBadRequestError() | |
} | |
guard let task = try self.tasksService.get(byId: id) else { | |
return response.sendNotFoundError() | |
} |
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
// Resource-based authorization. | |
let authorizationService = try! container.resolve() as AuthorizationServiceProtocol | |
authorizationService.add(policy: "EditPolicy", requirements: [SameAuthorRequirement()]) |
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
public func get(request: HTTPRequest, response: HTTPResponse) { | |
do { | |
guard let stringId = request.urlVariables["id"], let id = UUID(uuidString: stringId) else { | |
return response.sendBadRequestError() | |
} | |
guard let task = try self.tasksService.get(byId: id) else { | |
return response.sendNotFoundError() | |
} | |
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
// Resource-based authorization. | |
let authorizationService = try! container.resolve() as AuthorizationServiceProtocol | |
authorizationService.add(authorizationHandler: TaskOwnerAuthorizationHandler()) |
NewerOlder