This is the official API documentation for the Backend-Infra project, serving as the core infrastructure backend.
Tech Stack:
- Language: Go 1.21+
- Framework: Fiber (v2)
- ORM: GORM
- Database: MySQL
- Authentication: JWT (JSON Web Tokens)
The API uses JWT (JSON Web Token) for authentication.
- Login Flow: Send a
POSTrequest to/api/v1/auth/loginwithemailandpassword. - Token Format: The server responds with a token. Include it in the
Authorizationheader asBearer <token>for protected routes.
Example Header:
Authorization: Bearer eyJhbGciOiJIUzI1...Errors are standardized in JSON format with appropriate HTTP status codes (400, 401, 403, 404, 500).
{
"error": "Detailed error message"
}- Clone the repository.
- Copy
.env.exampleto.envand fill the variables (DB credentials,JWT_SECRET,APP_PORT). - Run
go run main.go. - GORM will auto-migrate the database schemas on startup.
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| Name | string |
- |
`` |
| Issuer | string |
- |
`` |
| Description | string |
- |
`` |
| Image | string |
- |
`` |
| CertificationNumber | string |
- |
`` |
| IssueDate | string |
- |
`` |
| ExpiryDate | string |
- |
`` |
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| Title | string |
title |
`` |
| Url | string |
url |
`` |
| Icon | string |
icon |
`` |
| UserID | uint |
user_id |
`` |
| User | User |
user |
constraint:OnUpdate:CASCADE,OnDelete:CASCADE; |
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| Name | string |
- |
`` |
| Slug | string |
- |
`` |
| Description | string |
- |
type:text |
| Icon | string |
- |
`` |
| IsActive | bool |
- |
default:true |
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| Name | string |
- |
`` |
| Position | string |
- |
`` |
| Photo | string |
- |
`` |
| Testimonial | string |
- |
`` |
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| Title | string |
title |
`` |
| InstanceName | string |
instance_name |
`` |
| ContactPerson | string |
contact_person |
`` |
string |
email |
`` | |
| Phone | string |
phone |
`` |
| Description | string |
description |
`` |
| Status | string |
status |
type:enum('pending','approved','rejected','hidden');default:'pending' |
| RejectionReason | string |
rejection_reason |
type:text |
| ApprovedAt | time.Time |
approved_at |
`` |
| RequestDate | time.Time |
request_date |
type:date |
| ShowInCalendar | bool |
show_in_calendar |
`` |
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| Title | string |
title |
`` |
| Description | string |
description |
type:text |
| Category | string |
category |
type:enum('kunjungan_industri', 'tamu', 'acara_sekolah', 'ujian', 'libur', 'lainnya');default:'tamu' |
| Visibility | string |
visibility |
type:enum('public', 'private');default:'private' |
| StartDate | string |
start_date |
`` |
| EndDate | string |
end_date |
`` |
| Location | string |
location |
`` |
| Organizer | string |
organizer |
`` |
| Image | string |
image |
`` |
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| Title | string |
title |
`` |
| Description | string |
description |
`` |
| Image | string |
image |
`` |
| AchievementDate | string |
achievement_date |
`` |
| NewsID | uint |
news_id |
`` |
| News | News |
news |
`` |
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| Name | string |
- |
`` |
| Logo | string |
- |
`` |
| Website | string |
- |
`` |
| Description | string |
- |
type:text |
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| FilePath | string |
file_path |
`` |
| Category | string |
category |
type:enum('berita', 'mading', 'galeri', 'teacher', 'eskul', 'achievement', 'testimonial', 'saprol', 'certification', 'portal', 'mitra', 'profile');default:'galeri' |
| Title | string |
title |
`` |
| EventID | uint |
event |
`` |
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| NIG | string |
nig |
`` |
| FullName | string |
full_name |
`` |
| Position | string |
position |
`` |
| Subject | string |
subject |
`` |
| Photo | string |
photo |
`` |
| Description | string |
description |
`` |
| UserID | uint |
user_id |
`` |
| User | User |
- |
`` |
| Eskuls | []Eskul |
eskuls |
foreignKey:PembinaID |
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| Name | string |
name |
unique;not null |
| News | []News |
news |
many2many:news_news_tags; |
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| Content | string |
content |
type:text; not null |
| UserID | uint |
user_id |
`` |
| PostID | uint |
post_id |
`` |
| ParentID | *uint |
parent_id |
`` |
| User | User |
user |
`` |
| Post | ForumPost |
post |
`` |
| Parent | *ForumReply |
parent |
foreignKey:ParentID |
| Children | []ForumReply |
children |
foreignKey:ParentID;constraint:OnDelete:CASCADE |
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| Title | string |
title |
`` |
| Slug | string |
slug |
`` |
| Content | string |
content |
type:text |
| Excerpt | string |
excerpt |
`` |
| Thumbnail | string |
thumbnail |
`` |
| Status | string |
status |
type:enum('draft', 'published', 'archived');default:'draft' |
| ViewCount | int |
view_count |
`` |
| Tags | []NewsTag |
tags |
many2many:news_news_tags; |
| AuthorID | uint |
author_id |
`` |
| Author | User |
author |
constraint:OnUpdate:CASCADE,OnDelete:CASCADE; |
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| Title | string |
title |
not null |
| Content | string |
content |
type:text |
| Image | string |
image |
`` |
| File | string |
file |
`` |
| Status | string |
- |
type:enum('pending','approved','rejected','hidden');default:'pending' |
| Upvote | int |
upvote |
`` |
| Downvote | int |
downvote |
`` |
| ReplyCount | int |
reply_count |
`` |
| IsHidden | bool |
is_hidden |
`` |
| UserID | uint |
user_id |
`` |
| SectionID | uint |
section_id |
`` |
| User | User |
user |
`` |
| Section | ForumSection |
section |
`` |
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| NoInduk | string |
no_induk |
`` |
| Name | string |
name |
`` |
string |
email |
unique |
|
| Password | string |
- |
`` |
| Role | string |
role |
type:enum('admin','guru','siswa','orang_tua');default:'siswa' |
| PhotoUrl | string |
photo_url |
`` |
| Phone | string |
phone |
`` |
| Alamat | string |
alamat |
type:text |
| Jabatan | string |
jabatan |
`` |
| TahunAjaranMulai | string |
tahun_ajaran_mulai |
type:year;default:null |
| UserLinks | []UserLinks |
user_links |
foreignKey:UserID |
| News | []News |
news |
foreignKey:AuthorID |
| Post | []ForumPost |
- |
foreignKey:UserID |
| Replies | []ForumReply |
- |
foreignKey:UserID |
| Teacher | []Teacher |
- |
foreignKey:UserID |
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| Name | string |
- |
`` |
| Description | string |
- |
`` |
| URL | string |
- |
`` |
| Logo | string |
- |
`` |
| Category | string |
- |
`` |
| IsSSOEnabled | bool |
- |
default:false |
| IsActive | bool |
- |
default:true |
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| Name | string |
name |
`` |
| Description | string |
description |
type:text |
| Image | string |
image |
`` |
| PembinaID | uint |
pembina_id |
`` |
| Pembina | Teacher |
pembina |
foreignKey:PembinaID |
| Field Name | Go Type | JSON Key | Constraints / GORM Tag |
|---|---|---|---|
| Title | string |
title |
`` |
| Type | string |
type |
type:enum('infographic', 'announcement');default:'infographic' |
| Content | string |
content |
type:text |
| Image | string |
image |
`` |
| Status | string |
status |
type:enum('draft', 'published', 'archieve');default:'draft' |
| IsActive | bool |
is_active |
`` |
Kumpulan endpoint untuk modul Public.
Group Route: /public/achievement
Handler: ShowAchievement
Authentication: None
Response Format: JSON
Group Route: /public/achievement
Handler: ShowAllAchievement
Authentication: None
Response Format: JSON
Group Route: /public/certification
Handler: ShowCertification
Authentication: None
Response Format: JSON
Group Route: /public/certification
Handler: ShowAllCertification
Authentication: None
Response Format: JSON
Group Route: /public/eskul
Handler: ShowEskul
Authentication: None
Response Format: JSON
Group Route: /public/eskul
Handler: ShowAllEskul
Authentication: None
Response Format: JSON
Group Route: /public/event
Handler: GetEvent
Authentication: None
Response Format: JSON
Group Route: /public/event
Handler: GetAllEvent
Authentication: None
Response Format: JSON
Group Route: /public/event
Handler: GetEventByDate
Authentication: None
Response Format: JSON
Group Route: /public/guest
Handler: CreateGuest
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"title": "string",
"instance_name": "string",
"contact_person": "string",
"email": "string",
"phone": "string",
"description": "string",
"request_date": "string",
}Response Format: JSON
Group Route: /public/guest
Handler: GetAllGuestBook
Authentication: None
Response Format: JSON
Group Route: /public/guest
Handler: GetGuestBook
Authentication: None
Response Format: JSON
Group Route: /public/image
Handler: ShowAllImages
Authentication: None
Response Format: JSON
Group Route: /public/image
Handler: ShowImagesByCategory
Authentication: None
Response Format: JSON
Group Route: /public/industry
Handler: ShowIndustry
Authentication: None
Response Format: JSON
Group Route: /public/industry
Handler: ShowAllIndustry
Authentication: None
Response Format: JSON
Group Route: /public/mading
Handler: ShowMading
Authentication: None
Response Format: JSON
Group Route: /public/mading
Handler: ShowAllMadings
Authentication: None
Response Format: JSON
Group Route: /public/news
Handler: GetAllNews
Authentication: None
Response Format: JSON
Group Route: /public/news
Handler: GetNews
Authentication: None
Response Format: JSON
Group Route: /public/portal
Handler: ShowPortal
Authentication: None
Response Format: JSON
Group Route: /public/portal
Handler: ShowAllPortal
Authentication: None
Response Format: JSON
Group Route: /public/teacher
Handler: ShowAllTeachers
Authentication: None
Response Format: JSON
Group Route: /public/teacher
Handler: ShowTeacher
Authentication: None
Response Format: JSON
Group Route: /public/testimonial
Handler: ShowAllTestimonial
Authentication: None
Response Format: JSON
Group Route: /public/testimonial
Handler: ShowTestimonial
Authentication: None
Response Format: JSON
Group Route: /public/user-link
Handler: ShowUserLinks
Authentication: None
Response Format: JSON
Group Route: /public/forum-section
Handler: ShowAllSection
Authentication: None
Response Format: JSON
Group Route: /public/user
Handler: ProfilePublic
Authentication: None
Response Format: JSON
Kumpulan endpoint untuk modul Certification.
Group Route: /certification
Handler: CreateCertification
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"name": "string",
"issuer": "string",
"description": "string",
"image": "string",
"certification_number": "string",
"issue_date": "string",
"expiry_date": "string",
}Response Format: JSON
Group Route: /certification
Handler: EditCertification
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"name": "string",
"issuer": "string",
"description": "string",
"image": "string",
"certification_number": "string",
"issue_date": "string",
"expiry_date": "string",
}Response Format: JSON
Group Route: /certification
Handler: ShowCertification
Authentication: None
Response Format: JSON
Group Route: /certification
Handler: ShowAllCertification
Authentication: None
Response Format: JSON
Group Route: /certification
Handler: DeleteCertification
Authentication: Required (JWT)
Response Format: JSON
Kumpulan endpoint untuk modul Auth.
Group Route: /auth
Handler: Register
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"name": "string",
"email": "string",
"password": "string",
}Response Format: JSON
Group Route: /auth
Handler: Login
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"email": "string",
"password": "string",
}Response Format: JSON
Group Route: /auth
Handler: Profile
Authentication: Required (JWT)
Response Format: JSON
Group Route: /auth
Handler: EditProfile
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"no_induk": "*string",
"name": "*string",
"email": "*string",
"role": "*string",
"photo_url": "*string",
"phone": "*string",
"alamat": "*string",
"jabatan": "*string",
"tahun_ajaran_mulai": "*string",
}Response Format: JSON
Kumpulan endpoint untuk modul Forum_section.
Group Route: /forum-section
Handler: CreateSection
Authentication: Required (JWT)
Response Format: JSON
Group Route: /forum-section
Handler: EditSection
Authentication: Required (JWT)
Response Format: JSON
Group Route: /forum-section
Handler: DeleteSection
Authentication: Required (JWT)
Response Format: JSON
Group Route: /forum-section
Handler: ShowAllSection
Authentication: None
Response Format: JSON
Kumpulan endpoint untuk modul Testimonial.
Group Route: /testimonial
Handler: CreateTestimonial
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"name": "string",
"position": "string",
"testimonial": "string",
}Response Format: JSON
Group Route: /testimonial
Handler: EditTestimonial
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"name": "string",
"position": "string",
"testimonial": "string",
}Response Format: JSON
Group Route: /testimonial
Handler: ShowTestimonial
Authentication: None
Response Format: JSON
Group Route: /testimonial
Handler: ShowAllTestimonial
Authentication: None
Response Format: JSON
Group Route: /testimonial
Handler: DeleteTestimonial
Authentication: Required (JWT)
Response Format: JSON
Kumpulan endpoint untuk modul Event.
Group Route: /event
Handler: CreateEvent
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"title": "string",
"description": "string",
"category": "string",
"start_date": "string",
"end_date": "string",
"location": "string",
"organizer": "string",
}Response Format: JSON
Group Route: /event
Handler: EditEvent
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"title": "string",
"description": "string",
"category": "string",
"start_date": "string",
"end_date": "string",
"location": "string",
"organizer": "string",
}Response Format: JSON
Group Route: /event
Handler: DeleteEvent
Authentication: Required (JWT)
Response Format: JSON
Group Route: /event
Handler: GetEvent
Authentication: None
Response Format: JSON
Group Route: /event
Handler: GetAllEvent
Authentication: None
Response Format: JSON
Group Route: /event
Handler: ChangeVisibility
Authentication: None
Response Format: JSON
Kumpulan endpoint untuk modul Achievement.
Group Route: /achievement
Handler: CreateAchievement
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"title": "string",
"description": "string",
"image": "string",
"achievement_date": "string",
"news_id": "uint",
}Response Format: JSON
Group Route: /achievement
Handler: EditAchievement
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"title": "string",
"description": "string",
"image": "string",
"achievement_date": "string",
"news_id": "uint",
}Response Format: JSON
Group Route: /achievement
Handler: ShowAchievement
Authentication: None
Response Format: JSON
Group Route: /achievement
Handler: ShowAllAchievement
Authentication: None
Response Format: JSON
Group Route: /achievement
Handler: DeleteAchievement
Authentication: Required (JWT)
Response Format: JSON
Kumpulan endpoint untuk modul Industry.
Group Route: /industry
Handler: CreateIndustry
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"name": "string",
"logo": "string",
"website": "string",
"description": "string",
}Response Format: JSON
Group Route: /industry
Handler: EditIndustry
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"name": "string",
"logo": "string",
"website": "string",
"description": "string",
}Response Format: JSON
Group Route: /industry
Handler: ShowIndustry
Authentication: None
Response Format: JSON
Group Route: /industry
Handler: ShowAllIndustry
Authentication: None
Response Format: JSON
Group Route: /industry
Handler: DeleteIndustry
Authentication: Required (JWT)
Response Format: JSON
Kumpulan endpoint untuk modul News.
Group Route: /news
Handler: CreateNews
Authentication: Required (JWT)
Response Format: JSON
Group Route: /news
Handler: UpdateNews
Authentication: None
Response Format: JSON
Group Route: /news
Handler: GetAllNews
Authentication: None
Response Format: JSON
Group Route: /news
Handler: GetNews
Authentication: None
Response Format: JSON
Group Route: /news
Handler: DeleteNews
Authentication: Required (JWT)
Response Format: JSON
Group Route: /news
Handler: AddView
Authentication: None
Response Format: JSON
Group Route: /news
Handler: ChangeStatus
Authentication: None
Response Format: JSON
Kumpulan endpoint untuk modul Teacher.
Group Route: /teacher
Handler: CreateTeacher
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"nig": "string",
"full_name": "string",
"position": "string",
"subject": "string",
"description": "string",
}Response Format: JSON
Group Route: /teacher
Handler: EditTeacher
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"nig": "string",
"full_name": "string",
"position": "string",
"subject": "string",
"description": "string",
}Response Format: JSON
Group Route: /teacher
Handler: DeleteTeacher
Authentication: Required (JWT)
Response Format: JSON
Group Route: /teacher
Handler: ShowAllTeachers
Authentication: None
Response Format: JSON
Group Route: /teacher
Handler: ShowTeacher
Authentication: None
Response Format: JSON
Kumpulan endpoint untuk modul User_links.
Group Route: /user-links
Handler: AddLink
Authentication: None
Response Format: JSON
Group Route: /user-links
Handler: EditLinks
Authentication: Required (JWT)
Response Format: JSON
Group Route: /user-links
Handler: ShowUserLinksSelf
Authentication: None
Response Format: JSON
Group Route: /user-links
Handler: DeleteLinks
Authentication: Required (JWT)
Response Format: JSON
Kumpulan endpoint untuk modul Guest_books.
Group Route: /guest-book
Handler: CreateGuest
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"title": "string",
"instance_name": "string",
"contact_person": "string",
"email": "string",
"phone": "string",
"description": "string",
"request_date": "string",
}Response Format: JSON
Group Route: /guest-book
Handler: EditGuest
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"title": "string",
"instance_name": "string",
"contact_person": "string",
"email": "string",
"phone": "string",
"description": "string",
"request_date": "string",
}Response Format: JSON
Group Route: /guest-book
Handler: GetAllGuestBook
Authentication: None
Response Format: JSON
Group Route: /guest-book
Handler: GetGuestBook
Authentication: None
Response Format: JSON
Group Route: /guest-book
Handler: ApprovedGuest
Authentication: None
Response Format: JSON
Group Route: /guest-book
Handler: RejectGuestBook
Authentication: None
Response Format: JSON
Kumpulan endpoint untuk modul Forum_post.
Group Route: /forum-post
Handler: CreatePost
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"title": "string",
"content": "string",
"section_id": "uint",
}Response Format: JSON
Group Route: /forum-post
Handler: EditPost
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"title": "string",
"content": "string",
"section_id": "uint",
}Response Format: JSON
Group Route: /forum-post
Handler: DeletePost
Authentication: Required (JWT)
Response Format: JSON
Group Route: /forum-post
Handler: GetAllPost
Authentication: None
Response Format: JSON
Group Route: /forum-post
Handler: ShowPostById
Authentication: None
Response Format: JSON
Group Route: /forum-post
Handler: ChangePostStatus
Authentication: None
Response Format: JSON
Group Route: /forum-post
Handler: UpvotePost
Authentication: None
Response Format: JSON
Group Route: /forum-post
Handler: DownvotePost
Authentication: None
Response Format: JSON
Group Route: /forum-post
Handler: CreateReply
Authentication: None
Response Format: JSON
Group Route: /forum-post
Handler: GetPostWithReplies
Authentication: None
Response Format: JSON
Group Route: /forum-post
Handler: GetNestedReplies
Authentication: None
Response Format: JSON
Kumpulan endpoint untuk modul Portal.
Group Route: /portal
Handler: CreatePortal
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"name": "string",
"description": "string",
"url": "string",
"logo": "string",
"category": "string",
}Response Format: JSON
Group Route: /portal
Handler: EditPortal
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"name": "string",
"description": "string",
"url": "string",
"logo": "string",
"category": "string",
}Response Format: JSON
Group Route: /portal
Handler: ShowPortal
Authentication: None
Response Format: JSON
Group Route: /portal
Handler: ShowAllPortal
Authentication: None
Response Format: JSON
Group Route: /portal
Handler: DeletePortal
Authentication: Required (JWT)
Response Format: JSON
Kumpulan endpoint untuk modul Eskul.
Group Route: /eskul
Handler: CreateEskul
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"name": "string",
"description": "string",
"pembina_id": "uint",
}Response Format: JSON
Group Route: /eskul
Handler: EditEskul
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"name": "string",
"description": "string",
"pembina_id": "uint",
}Response Format: JSON
Group Route: /eskul
Handler: ShowEskul
Authentication: None
Response Format: JSON
Group Route: /eskul
Handler: ShowAllEskul
Authentication: None
Response Format: JSON
Group Route: /eskul
Handler: DeleteEskul
Authentication: Required (JWT)
Response Format: JSON
Kumpulan endpoint untuk modul Image.
Group Route: /image
Handler: AddImage
Authentication: None
Response Format: JSON
Group Route: /image
Handler: DeleteImage
Authentication: Required (JWT)
Response Format: JSON
Group Route: /image
Handler: ShowAllImages
Authentication: None
Response Format: JSON
Group Route: /image
Handler: ShowImagesByCategory
Authentication: None
Response Format: JSON
Kumpulan endpoint untuk modul Mading.
Group Route: /mading
Handler: CreateMading
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"title": "string",
"type": "string",
"content": "string",
"image": "uint",
}Response Format: JSON
Group Route: /mading
Handler: EditMading
Authentication: Required (JWT)
Request Body Schema (JSON):
{
"title": "string",
"type": "string",
"content": "string",
"image": "uint",
}Response Format: JSON
Group Route: /mading
Handler: ShowMading
Authentication: None
Response Format: JSON
Group Route: /mading
Handler: ShowAllMadings
Authentication: None
Response Format: JSON
Group Route: /mading
Handler: DeleteMading
Authentication: Required (JWT)
Response Format: JSON
Group Route: /mading
Handler: ChangeStatusMading
Authentication: None
Response Format: JSON