Skip to content

Commit e35b94d

Browse files
committed
AppApi target
1 parent 4c1bf79 commit e35b94d

File tree

15 files changed

+307
-187
lines changed

15 files changed

+307
-187
lines changed

Chapter 16/myProject/Package.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ let package = Package(
55
name: "myProject",
66
platforms: [
77
.macOS(.v12)
8+
],
9+
products: [
10+
811
],
912
dependencies: [
1013
.package(url: "https://github.com/vapor/vapor", from: "4.54.0"),
@@ -16,6 +19,9 @@ let package = Package(
1619
.package(url: "https://github.com/binarybirds/spec", from: "1.2.0"),
1720
],
1821
targets: [
22+
.target(name: "AppApi", dependencies: [
23+
24+
]),
1925
.target(name: "App", dependencies: [
2026
.product(name: "Vapor", package: "vapor"),
2127
.product(name: "Fluent", package: "fluent"),
@@ -24,6 +30,8 @@ let package = Package(
2430
.product(name: "LiquidLocalDriver", package: "liquid-local-driver"),
2531
.product(name: "SwiftHtml", package: "swift-html"),
2632
.product(name: "SwiftSvg", package: "swift-html"),
33+
34+
.target(name: "AppApi")
2735
]),
2836
.executableTarget(name: "Run", dependencies: ["App"]),
2937
.testTarget(name: "AppTests", dependencies: [
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Tibor Bodecs on 2022. 01. 09..
6+
//
7+
8+
import Vapor
9+
10+
extension ApiModelInterface {
11+
12+
static var pathIdComponent: PathComponent { .init(stringLiteral: ":" + pathIdKey) }
13+
}
14+

Chapter 16/myProject/Sources/App/Modules/Blog/Objects/BlogCategory.swift

Lines changed: 0 additions & 42 deletions
This file was deleted.

Chapter 16/myProject/Sources/App/Modules/Blog/Objects/BlogPost.swift

Lines changed: 0 additions & 68 deletions
This file was deleted.

Chapter 16/myProject/Sources/App/Modules/User/Objects/UserAccount.swift

Lines changed: 0 additions & 43 deletions
This file was deleted.

Chapter 16/myProject/Sources/App/Modules/User/Objects/UserToken.swift

Lines changed: 0 additions & 24 deletions
This file was deleted.

Chapter 16/myProject/Sources/App/configure.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Fluent
1010
import FluentSQLiteDriver
1111
import Liquid
1212
import LiquidLocalDriver
13+
@_exported import AppApi
1314

1415
public func configure(_ app: Application) throws {
1516

Chapter 16/myProject/Sources/App/Framework/ApiModelInterface.swift renamed to Chapter 16/myProject/Sources/AppApi/Framework/ApiModelInterface.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,15 @@
55
// Created by Tibor Bodecs on 2022. 01. 06..
66
//
77

8-
import Vapor
9-
10-
protocol ApiModelInterface {
8+
public protocol ApiModelInterface {
119
associatedtype Module: ApiModuleInterface
1210

1311
static var pathKey: String { get }
1412
static var pathIdKey: String { get }
1513
}
1614

17-
extension ApiModelInterface {
15+
public extension ApiModelInterface {
1816
static var pathKey: String { String(describing: self).lowercased() + "s" }
1917
static var pathIdKey: String { String(describing: self).lowercased() + "Id" }
20-
21-
static var pathIdComponent: PathComponent { .init(stringLiteral: ":" + pathIdKey) }
2218
}
2319

Chapter 16/myProject/Sources/App/Framework/ApiModuleInterface.swift renamed to Chapter 16/myProject/Sources/AppApi/Framework/ApiModuleInterface.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
// Created by Tibor Bodecs on 2022. 01. 06..
66
//
77

8-
import Foundation
9-
108
public protocol ApiModuleInterface {
119
static var pathKey: String { get }
1210
}

Chapter 16/myProject/Sources/App/Modules/Blog/Objects/Blog.swift renamed to Chapter 16/myProject/Sources/AppApi/Modules/Blog/Blog.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
// Created by Tibor Bodecs on 2021. 12. 31..
66
//
77

8-
enum Blog: ApiModuleInterface {
8+
public enum Blog: ApiModuleInterface {
99

1010
}

0 commit comments

Comments
 (0)