Skip to content

Commit

Permalink
make eslint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
IMax153 committed Oct 31, 2024
1 parent 0a859af commit 45e9b5c
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 34 deletions.
10 changes: 5 additions & 5 deletions examples/http-server/src/Accounts/AccountsRepo.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Model } from "@effect/sql"
import { Effect } from "effect"
import { Account } from "../Domain/Account.js"
import { SqlLive } from "../Sql.js"
import { makeTestLayer } from "../lib/Layer.js"
import { SqlLive } from "../Sql.js"

export const make = Model.makeRepository(Account, {
tableName: "accounts",
spanPrefix: "AccountsRepo",
idColumn: "id",
idColumn: "id"
})

export class AccountsRepo extends Effect.Service<AccountsRepo>()(
Expand All @@ -16,10 +16,10 @@ export class AccountsRepo extends Effect.Service<AccountsRepo>()(
effect: Model.makeRepository(Account, {
tableName: "accounts",
spanPrefix: "AccountsRepo",
idColumn: "id",
idColumn: "id"
}),
dependencies: [SqlLive],
},
dependencies: [SqlLive]
}
) {
static Test = makeTestLayer(AccountsRepo)({})
}
4 changes: 2 additions & 2 deletions examples/http-server/src/Accounts/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class Authentication extends HttpApiMiddleware.Tag<Authentication>()(
})
}
}
) { }
) {}

export class AccountsApi extends HttpApiGroup.make("accounts")
.add(
Expand Down Expand Up @@ -45,4 +45,4 @@ export class AccountsApi extends HttpApiGroup.make("accounts")
)
.annotate(OpenApi.Title, "Accounts")
.annotate(OpenApi.Description, "Manage user accounts")
{ }
{}
2 changes: 1 addition & 1 deletion examples/http-server/src/Accounts/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ export class AccountsPolicy extends Effect.Service<AccountsPolicy>()(
return { canUpdate, canRead, canReadSensitive } as const
})
}
) { }
) {}
2 changes: 1 addition & 1 deletion examples/http-server/src/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export class Api extends HttpApi.empty
.add(GroupsApi)
.add(PeopleApi)
.annotate(OpenApi.Title, "Groups API")
{ }
{}
4 changes: 2 additions & 2 deletions examples/http-server/src/Domain/Group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ export class Group extends Model.Class<Group>("Group")({
name: Schema.NonEmptyTrimmedString,
createdAt: Model.DateTimeInsert,
updatedAt: Model.DateTimeUpdate
}) { }
}) {}

export class GroupNotFound extends Schema.TaggedError<GroupNotFound>()(
"GroupNotFound",
{ id: GroupId },
HttpApiSchema.annotations({ status: 404 })
) { }
) {}
4 changes: 2 additions & 2 deletions examples/http-server/src/Domain/Person.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export class Person extends Model.Class<Person>("Person")({
dateOfBirth: Model.FieldOption(Model.Date),
createdAt: Model.DateTimeInsert,
updatedAt: Model.DateTimeUpdate
}) { }
}) {}

export class PersonNotFound extends Schema.TaggedError<PersonNotFound>()(
"PersonNotFound",
{
id: PersonId
}
) { }
) {}
18 changes: 9 additions & 9 deletions examples/http-server/src/Domain/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,24 @@ export const policy = <Entity extends string, Action extends string, E, R>(
export const policyCompose = <Actor extends AuthorizedActor<any, any>, E, R>(
that: Effect.Effect<Actor, E, R>
) =>
<Actor2 extends AuthorizedActor<any, any>, E2, R2>(
self: Effect.Effect<Actor2, E2, R2>
): Effect.Effect<Actor | Actor2, E | Unauthorized, R | CurrentUser> => Effect.zipRight(self, that) as any
<Actor2 extends AuthorizedActor<any, any>, E2, R2>(
self: Effect.Effect<Actor2, E2, R2>
): Effect.Effect<Actor | Actor2, E | Unauthorized, R | CurrentUser> => Effect.zipRight(self, that) as any

export const policyUse = <Actor extends AuthorizedActor<any, any>, E, R>(
policy: Effect.Effect<Actor, E, R>
) =>
<A, E2, R2>(
effect: Effect.Effect<A, E2, R2>
): Effect.Effect<A, E | E2, Exclude<R2, Actor> | R> => policy.pipe(Effect.zipRight(effect)) as any
<A, E2, R2>(
effect: Effect.Effect<A, E2, R2>
): Effect.Effect<A, E | E2, Exclude<R2, Actor> | R> => policy.pipe(Effect.zipRight(effect)) as any

export const policyRequire = <Entity extends string, Action extends string>(
_entity: Entity,
_action: Action
) =>
<A, E, R>(
effect: Effect.Effect<A, E, R>
): Effect.Effect<A, E, R | AuthorizedActor<Entity, Action>> => effect
<A, E, R>(
effect: Effect.Effect<A, E, R>
): Effect.Effect<A, E, R | AuthorizedActor<Entity, Action>> => effect

export const withSystemActor = <A, E, R>(
effect: Effect.Effect<A, E, R>
Expand Down
8 changes: 4 additions & 4 deletions examples/http-server/src/Domain/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ export class User extends Model.Class<User>("User")({
accessToken: Model.Sensitive(AccessToken),
createdAt: Model.DateTimeInsert,
updatedAt: Model.DateTimeUpdate
}) { }
}) {}

export class UserWithSensitive extends Model.Class<UserWithSensitive>(
"UserWithSensitive"
)({
...Model.fields(User),
accessToken: AccessToken,
account: Account
}) { }
}) {}

export class CurrentUser extends Context.Tag("Domain/User/CurrentUser")<
CurrentUser,
User
>() { }
>() {}

export class UserNotFound extends Schema.TaggedError<UserNotFound>()(
"UserNotFound",
{ id: UserId },
HttpApiSchema.annotations({ status: 404 })
) { }
) {}
2 changes: 1 addition & 1 deletion examples/http-server/src/Groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ export class Groups extends Effect.Service<Groups>()("Groups", {
return { create, update, findById, with: with_ } as const
}),
dependencies: [SqlLive, GroupsRepo.Default]
}) { }
}) {}
2 changes: 1 addition & 1 deletion examples/http-server/src/Groups/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ export class GroupsApi extends HttpApiGroup.make("groups")
.prefix("/groups")
.annotate(OpenApi.Title, "Groups")
.annotate(OpenApi.Description, "Manage groups")
{ }
{}
2 changes: 1 addition & 1 deletion examples/http-server/src/Groups/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export class GroupsPolicy extends Effect.Service<GroupsPolicy>()(
return { canCreate, canUpdate } as const
})
}
) { }
) {}
2 changes: 1 addition & 1 deletion examples/http-server/src/Groups/Repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export class GroupsRepo extends Effect.Service<GroupsRepo>()("Groups/Repo", {
idColumn: "id"
}),
dependencies: [SqlLive]
}) { }
}) {}
2 changes: 1 addition & 1 deletion examples/http-server/src/People.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ export class People extends Effect.Service<People>()("People", {
return { create, findById, with: with_ } as const
}),
dependencies: [SqlLive, PeopleRepo.Default]
}) { }
}) {}
2 changes: 1 addition & 1 deletion examples/http-server/src/People/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ export class PeopleApi extends HttpApiGroup.make("people")
.middleware(Authentication)
.annotate(OpenApi.Title, "People")
.annotate(OpenApi.Description, "Manage people")
{ }
{}
2 changes: 1 addition & 1 deletion examples/http-server/src/People/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ export class PeoplePolicy extends Effect.Service<PeoplePolicy>()(
}),
dependencies: [GroupsPolicy.Default, Groups.Default, People.Default]
}
) { }
) {}
2 changes: 1 addition & 1 deletion examples/http-server/src/People/Repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export class PeopleRepo extends Effect.Service<PeopleRepo>()("People/Repo", {
idColumn: "id"
}),
dependencies: [SqlLive]
}) { }
}) {}

0 comments on commit 45e9b5c

Please sign in to comment.