Skip to content

Commit 82b8591

Browse files
committed
fixes
1 parent e804ffa commit 82b8591

File tree

27 files changed

+241
-232
lines changed

27 files changed

+241
-232
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
IMAGE_ID := ghcr.io/hexlet-components/rest-api-example
2-
PORT := 5000
2+
PORT := 5037
33

44
setup:
55
npm ci

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ See [Makefile](./Makefile)
1111

1212
```bash
1313
make docker-build
14-
make docker-run # Open http://localhost:5000
14+
make docker-run # Open http://localhost:5037
1515
```
1616

1717
---

typespec/http-api/services/commentsService.tsp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ interface CommentService {
2525
@query select?: string
2626
): Comment;
2727

28-
@useAuth([BearerAuth, BasicAuth])
28+
@useAuth(BearerAuth)
2929
@post
3030
op create(...NewCommentDto): Comment;
3131

32-
@useAuth([BearerAuth, BasicAuth])
32+
@useAuth(BearerAuth)
3333
@patch
3434
@opExample(
3535
#{ parameters: #{ id: "238593a0-b8d4-4bf6-beda-48ce6ba093bc" } }
3636
)
3737
op update(@path id: string, ...EditCommentDto): Comment;
3838

39-
@useAuth([BearerAuth, BasicAuth])
39+
@useAuth(BearerAuth)
4040
@delete
4141
@opExample(
4242
#{ parameters: #{ id: "238593a0-b8d4-4bf6-beda-48ce6ba093bc" } }

typespec/http-api/services/postsService.tsp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ interface PostService {
2727
@query select?: string
2828
): Post;
2929

30-
@useAuth([BearerAuth, BasicAuth])
30+
@useAuth(BearerAuth)
3131
@post
3232
op create(...NewPostDto): Post;
3333

34-
@useAuth([BearerAuth, BasicAuth])
34+
@useAuth(BearerAuth)
3535
@patch
3636
@opExample(
3737
#{ parameters: #{ id: "fb5e19a3-ab33-423b-9cec-8ee4ef211c61" } }
3838
)
3939
op update(@path id: string, ...EditPostDto): Post;
4040

41-
@useAuth([BearerAuth, BasicAuth])
41+
@useAuth(BearerAuth)
4242
@delete
4343
@opExample(
4444
#{ parameters: #{ id: "fb5e19a3-ab33-423b-9cec-8ee4ef211c61" } }

typespec/http-api/services/usersService.tsp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ interface UserService {
3333
@post
3434
op create(...NewUserDto): User;
3535

36-
@useAuth([BearerAuth, BasicAuth])
36+
@useAuth(BearerAuth)
3737
@patch
3838
@opExample(
3939
#{ parameters: #{ id: "a788f3fc-0d47-4d55-b18b-09bae52dac7b" } }
4040
)
4141
op update(@path id: string, ...EditUserDto): User;
4242

43-
@useAuth([BearerAuth, BasicAuth])
43+
@useAuth(BearerAuth)
4444
@delete
4545
@opExample(
4646
#{ parameters: #{ id: "a788f3fc-0d47-4d55-b18b-09bae52dac7b" } }

typespec/http-protocol/models/auth.tsp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
@example(#{ email: "[email protected]", password: "password" }, #{ title: "Authentication data", description: "Login and password for authentication" })
1+
import "../../examples/auth.tsp";
2+
3+
@example(
4+
authDataExample,
5+
#{
6+
title:
7+
"Authentication data",
8+
description: "Login and password for authentication"
9+
}
10+
)
211
model AuthData {
312
@minLength(1)
413
email: string;
@@ -8,9 +17,7 @@ model AuthData {
817
}
918

1019
@example(
11-
#{
12-
token: "secret_token"
13-
},
20+
authTokenExample,
1421
#{ title: "Authorisation data", description: "Token for authorisation" }
1522
)
1623
model AuthToken {

typespec/http-protocol/models/comment.tsp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
import "../../examples/comments.tsp";
2+
13
@example(
2-
#{
3-
postId: "some_post_id",
4-
body: "new comment body"
5-
},
4+
newCommentDtoExample,
65
#{ title: "New comment" }
76
)
87
model NewCommentDto {
@@ -13,10 +12,7 @@ model NewCommentDto {
1312
}
1413

1514
@example(
16-
#{
17-
postId: "some_post_id",
18-
body: "edit comment body"
19-
},
15+
editCommentDtoExample,
2016
#{ title: "Edit comment" }
2117
)
2218
model EditCommentDto {
@@ -27,12 +23,7 @@ model EditCommentDto {
2723
}
2824

2925
@example(
30-
#{
31-
id: "some-post-id",
32-
authorId: "some_user_id",
33-
postId: "some_post_id",
34-
body: "comment body"
35-
},
26+
commentExample,
3627
#{ title: "Comment" }
3728
)
3829
model Comment {
@@ -46,6 +37,15 @@ model Comment {
4637
body: string;
4738
}
4839

40+
@example(
41+
#{
42+
comments: commentsExample,
43+
total: totalCommentsExample,
44+
skip: skipCommentsExample,
45+
limit: limitCommentsExample,
46+
},
47+
#{ title: "Comments" }
48+
)
4949
model Comments {
5050
comments: Comment[];
5151
total: integer;

typespec/http-protocol/models/course.tsp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
import "../../examples/courses.tsp";
2+
13
@example(
2-
#{
3-
title: "New course",
4-
description: "description"
5-
},
4+
newCourseDtoExample,
65
#{ title: "New Course" }
76
)
87
model NewCourseDto {
@@ -15,10 +14,7 @@ model NewCourseDto {
1514
}
1615

1716
@example(
18-
#{
19-
title: "Edited course",
20-
description: "new description",
21-
},
17+
editCourseDtoExample,
2218
#{ title: "Edit Course" }
2319
)
2420
model EditCourseDto {
@@ -30,11 +26,7 @@ model EditCourseDto {
3026
}
3127

3228
@example(
33-
#{
34-
id: "some-id",
35-
title: "Edited course",
36-
description: "new description"
37-
},
29+
courseExample,
3830
#{ title: "Course" }
3931
)
4032
model Course {
@@ -49,6 +41,15 @@ model Course {
4941

5042
}
5143

44+
@example(
45+
#{
46+
courses: coursesExample,
47+
total: totalCoursesExample,
48+
skip: skipCoursesExample,
49+
limit: limitCoursesExample,
50+
},
51+
#{ title: "Courses" }
52+
)
5253
model Courses {
5354
courses: Course[];
5455
total: integer;

typespec/http-protocol/models/post.tsp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
import "../../examples/posts.tsp";
2+
13
@example(
2-
#{
3-
title: "new post title",
4-
body: "new post body"
5-
},
4+
newPostDtoExample,
65
#{ title: "New Post" }
76
)
87
model NewPostDto {
@@ -14,10 +13,7 @@ model NewPostDto {
1413
}
1514

1615
@example(
17-
#{
18-
title: "edit post title",
19-
body: "edit post body"
20-
},
16+
editPostDtoExample,
2117
#{ title: "Edit Post" }
2218
)
2319
model EditPostDto {
@@ -29,12 +25,7 @@ model EditPostDto {
2925
}
3026

3127
@example(
32-
#{
33-
id: "fb5e19a3-ab33-423b-9cec-8ee4ef211c61",
34-
authorId: "some_user_id",
35-
title: "post title",
36-
body: "post body"
37-
},
28+
postExample,
3829
#{ title: "Post" }
3930
)
4031
model Post {
@@ -50,6 +41,15 @@ model Post {
5041
body: string;
5142
}
5243

44+
@example(
45+
#{
46+
posts: postsExample,
47+
total: totalPostsExample,
48+
skip: skipPostsExample,
49+
limit: limitPostsExample,
50+
},
51+
#{ title: "posts" }
52+
)
5353
model Posts {
5454
posts: Post[];
5555
total: integer;

typespec/http-protocol/models/task.tsp

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1+
import "../../examples/tasks.tsp";
2+
13
@example(
2-
#{
3-
title: "New Task",
4-
description: "description",
5-
status: Status.Ready,
6-
},
4+
newTaskDtoExample,
75
#{ title: "New Task" }
86
)
97
model NewTaskDto {
@@ -17,11 +15,7 @@ model NewTaskDto {
1715
}
1816

1917
@example(
20-
#{
21-
title: "Edited Task",
22-
description: "new description",
23-
status: Status.Ready,
24-
},
18+
editTaskDtoExample,
2519
#{ title: "Edit Task" }
2620
)
2721
model EditTaskDto {
@@ -35,12 +29,7 @@ model EditTaskDto {
3529
}
3630

3731
@example(
38-
#{
39-
id: "some-id",
40-
title: "Edited Task",
41-
description: "new description",
42-
status: Status.Ready,
43-
},
32+
taskExample,
4433
#{ title: "Task" }
4534
)
4635
model Task {
@@ -56,6 +45,15 @@ model Task {
5645
status: Status;
5746
}
5847

48+
@example(
49+
#{
50+
tasks: tasksExample,
51+
total: totalTasksExample,
52+
skip: skipTasksExample,
53+
limit: limitTasksExample,
54+
},
55+
#{ title: "Tasks" }
56+
)
5957
model Tasks {
6058
tasks: Task[];
6159
total: integer;

0 commit comments

Comments
 (0)