Skip to content

Commit

Permalink
update rules
Browse files Browse the repository at this point in the history
  • Loading branch information
phantumcode committed Sep 14, 2024
1 parent 9f73de8 commit 0ab3eb3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ public extension ModelCompositePkWithAssociation {
)

model.fields(
.field(modelCompositePkWithAssociation.id, is: .required, ofType: .string),
.field(modelCompositePkWithAssociation.dob, is: .required, ofType: .dateTime),
.field(modelCompositePkWithAssociation.name, is: .optional, ofType: .string),
.hasMany(
modelCompositePkWithAssociation.otherModels,
is: .optional,
ofType: ModelCompositePkBelongsTo.self,
associatedWith: ModelCompositePkBelongsTo.keys.owner
),
.field(modelCompositePkWithAssociation.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime),
.field(modelCompositePkWithAssociation.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime)
.field(modelCompositePkWithAssociation.id, is: .required, ofType: .string),
.field(modelCompositePkWithAssociation.dob, is: .required, ofType: .dateTime),
.field(modelCompositePkWithAssociation.name, is: .optional, ofType: .string),
.hasMany(
modelCompositePkWithAssociation.otherModels,
is: .optional,
ofType: ModelCompositePkBelongsTo.self,
associatedWith: ModelCompositePkBelongsTo.keys.owner
),
.field(modelCompositePkWithAssociation.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime),
.field(modelCompositePkWithAssociation.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime)
)
}
}
Expand Down
28 changes: 14 additions & 14 deletions AmplifyTestCommon/Models/Record+Schema.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ public extension Record {
model.listPluralName = "Records"

model.fields(
.id(),
.field(record.name, is: .required, ofType: .string),
.field(record.description, is: .optional, ofType: .string),
.field(record.coverId, is: .optional, isReadOnly: true, ofType: .string),
.hasOne(
record.cover,
is: .optional,
isReadOnly: true,
ofType: RecordCover.self,
associatedWith: RecordCover.keys.id,
targetName: "coverId"
),
.field(record.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime),
.field(record.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime)
.id(),
.field(record.name, is: .required, ofType: .string),
.field(record.description, is: .optional, ofType: .string),
.field(record.coverId, is: .optional, isReadOnly: true, ofType: .string),
.hasOne(
record.cover,
is: .optional,
isReadOnly: true,
ofType: RecordCover.self,
associatedWith: RecordCover.keys.id,
targetName: "coverId"
),
.field(record.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime),
.field(record.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ class DefaultHubPluginTests: XCTestCase {

var plugin: HubCategoryPlugin {
guard let plugin = try? Amplify.Hub.getPlugin(for: "awsHubPlugin"),
plugin.key == "awsHubPlugin"
else {
plugin.key == "awsHubPlugin" else {
fatalError("Could not access AWSHubPlugin")
}
return plugin
Expand Down Expand Up @@ -126,8 +125,7 @@ class DefaultHubPluginTests: XCTestCase {
with: unsubscribeToken,
plugin: plugin,
timeout: 0.5
)
else {
) else {
XCTFail("Token with \(unsubscribeToken.id) was not registered")
return
}
Expand Down

0 comments on commit 0ab3eb3

Please sign in to comment.